diff --git a/.DS_Store b/.DS_Store index e95db01..7a0d612 100644 Binary files a/.DS_Store and b/.DS_Store differ 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: