From 7c6d0e8c349f0936875cf02c876d7856f6d27c21 Mon Sep 17 00:00:00 2001 From: OttoMao Date: Tue, 28 Feb 2017 18:15:58 +0800 Subject: [PATCH] rebuild 4.x docs --- .DS_Store | Bin 8196 -> 8196 bytes 4.x/index.html | 25 +++---------------------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/.DS_Store b/.DS_Store index e95db0166097ee789f3c7a9a957b6822d5235392..7a0d61220790ce995ac8f34871074442a76800ef 100644 GIT binary patch delta 1026 zcmb`FPe@cz6voe|X7A*`JL>4u9Q!j`qm7kXnt!s%OpPciot!kPao)2YjWg*Rm0UPc zQUodFR0}r}trqc^B`hW!1yEqRJL(Uq64 zs=lFKV_?XLTog`4SrnOB8C;|mvzS*-YV!U=VJ$vUODJlQx=~T0J#k^*pe}c-&ZX*R z7JjAEluxu~l(Uhx@<#1bHd3dl`O)JokHpb(AF4Vs`y znx=d7ke<*2J*SuSieA$jTA~m1kv`F9`byvEJN*EGu?A_#$9iml6D24^6{@ilHE2K! z_M;8$IE*g%(2X7h5JZ15E?@woxPoz9#Wmc)4DMqVb9jJxEX0oFw99ZEt+{O_{}isB zc`4mWG$+?y>~y&+YZ^Q;SFRTv8_TVamXtbJK*qz1GQNVcQinq%$>idPimg&hmO)rr zRW&=rD#_eZYj-h=6d8)8Htv>cs>H7>7UZjW+{`T;{~Cf6r^jV6U52}iHu^W)yEIEr zCD*s~j^0bAUnI|;^b0A-L>^SEMG+j>1Q*J&1#U^R7Immk5N%BmJ&F!^aa?jegI;LR x(TA{vY9fLmjNuY4C-6>S5;s#ZgGD7{=d6vu4JBv+J6(v1{Ziny#g0YyJUOOCSyw7# zDUCXaksEY~Afi(mL{UL?FQ`l8p*nPl>d>XAOQ-sFr!GMS(Hv&J?|t~*?|q)%EP5Bc zH)V@M%2)bql5bMBCN(xUIGxa9x-r7y2LGmOE#0X}S)Mi6FpGo|T9WMzC72P^!ZH1T zcAUu&R|`tFY<1PtH??$htrr#*%aT>HjV3iin~Jc&oTes@jD?Ia(^XABd{9%Fp3n|y zEG}AdS46)ain4XNsJL)*nW6+|r?i<_EpbeC34+fdF`A|YTB2n-N0;attbi#AZJp_ATL4me-qw~9E1eR@Ca!a? z_L@qkQ_kT?GaGk3S8_QaQ)_IJoN^wAVXB@MNs>2kTBh3G!PSkNi>Z3MxJsEHNBnct zsb8|bN~?6A=lq;r&}*LY2cGX&`i49dqYQR9;6yp9u^n}AqaGgYK`YwOlMT2ZLl}l1 z0gPZ0A%uCzjE6kULpG4WJW@D`Q&_+fmT?{{$V=k_F5iAo+Px{I*#FhVe=*Vd?=F6t H7|8h!^R4w< diff --git a/4.x/index.html b/4.x/index.html index 802ce88..bdfca7d 100644 --- a/4.x/index.html +++ b/4.x/index.html @@ -341,8 +341,6 @@ newResponse.body += '--from anyproxy--';
anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_use_local_response.js
/* 
   sample: 
     intercept all requests toward httpbin.org, use a local response
-  start proyx:
-    anyproxy --rule sample_use_local_response.js
   test:
     curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001
 */
@@ -366,8 +364,6 @@ newResponse.body += '--from anyproxy--';
 
anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_request_header.js
/* 
   sample: 
     modify the user-agent in requests toward httpbin.org
-  start proyx:
-    anyproxy --rule sample_modify_request_header.js
   test:
     curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001
 */
@@ -388,21 +384,16 @@ newResponse.body += '--from anyproxy--';
 
anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_request_data.js
/* 
   sample: 
     modify the post data towards http://httpbin.org/post
-  start proyx:
-    anyproxy --rule sample_modify_request_data.js
   test:
-    curl http://httpbin.org/ --proxy http://127.0.0.1:8001
+    curl -H "Content-Type: text/plain" -X POST -d 'original post data' http://httpbin.org/post --proxy http://127.0.0.1:8001
   expected response:
     { "data": "i-am-anyproxy-modified-post-data" }
-
 */
 module.exports = {
   *beforeSendRequest(requestDetail) {
-    if (requestDetail.url.indexOf('http://httpbin.org') === 0) {
-      const newRequestOptions = requestDetail.requestOptions;
-      newRequestOptions.headers['User-Agent'] = 'AnyProxy/0.0.0';
+    if (requestDetail.url.indexOf('http://httpbin.org/post') === 0) {
       return {
-        requestOptions: newRequestOptions
+        requestData: 'i-am-anyproxy-modified-post-data'
       };
     }
   },
@@ -413,8 +404,6 @@ newResponse.body += '--from anyproxy--';
 
anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_request_path.js
/* 
   sample: 
     redirect all httpbin.org requests to http://httpbin.org/user-agent
-  start proyx:
-    anyproxy --rule sample_modify_request_path.js
   test:
     curl http://httpbin.org/any-path --proxy http://127.0.0.1:8001
   expected response:
@@ -438,8 +427,6 @@ newResponse.body += '--from anyproxy--';
 
anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_request_protocol.js
/* 
   sample: 
     redirect all http requests of httpbin.org to https
-  start proyx:
-    anyproxy --rule sample_modify_request_protocol.js
   test:
     curl 'http://httpbin.org/get?show_env=1' --proxy http://127.0.0.1:8001
   expected response:
@@ -463,8 +450,6 @@ newResponse.body += '--from anyproxy--';
 
anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_response_statuscode.js
/* 
   sample: 
     modify all status code of http://httpbin.org/ to 404
-  start proyx:
-    anyproxy --rule sample_modify_response_statuscode.js
   test:
     curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001
   expected response:
@@ -487,8 +472,6 @@ newResponse.body += '--from anyproxy--';
 
anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_response_header.js
/* 
   sample: 
     modify response header of http://httpbin.org/user-agent
-  start proyx:
-    anyproxy --rule sample_modify_response_header.js
   test:
     curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001
   expected response:
@@ -511,8 +494,6 @@ newResponse.body += '--from anyproxy--';
 
anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_response_data.js
/* 
   sample: 
     modify response data of http://httpbin.org/user-agent
-  start proyx:
-    anyproxy --rule sample.js
   test:
     curl 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001
   expected response: