rebuild 4.x docs

This commit is contained in:
OttoMao 2017-02-28 18:15:58 +08:00
parent 19ad4d54a6
commit 7c6d0e8c34
2 changed files with 3 additions and 22 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -341,8 +341,6 @@ newResponse.body += <span class="hljs-string">'--from anyproxy--'</span>;
<pre class="hljs"><code>anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_use_local_response.js</code></pre><pre class="hljs"><code><span class="hljs-comment">/* <pre class="hljs"><code>anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_use_local_response.js</code></pre><pre class="hljs"><code><span class="hljs-comment">/*
sample: sample:
intercept all requests toward httpbin.org, use a local response intercept all requests toward httpbin.org, use a local response
start proyx:
anyproxy --rule sample_use_local_response.js
test: test:
curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001 curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001
*/</span> */</span>
@ -366,8 +364,6 @@ newResponse.body += <span class="hljs-string">'--from anyproxy--'</span>;
<pre class="hljs"><code>anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_request_header.js</code></pre><pre class="hljs"><code><span class="hljs-comment">/* <pre class="hljs"><code>anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_request_header.js</code></pre><pre class="hljs"><code><span class="hljs-comment">/*
sample: sample:
modify the user-agent in requests toward httpbin.org modify the user-agent in requests toward httpbin.org
start proyx:
anyproxy --rule sample_modify_request_header.js
test: test:
curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001 curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001
*/</span> */</span>
@ -388,21 +384,16 @@ newResponse.body += <span class="hljs-string">'--from anyproxy--'</span>;
<pre class="hljs"><code>anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_request_data.js</code></pre><pre class="hljs"><code><span class="hljs-comment">/* <pre class="hljs"><code>anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_request_data.js</code></pre><pre class="hljs"><code><span class="hljs-comment">/*
sample: sample:
modify the post data towards http://httpbin.org/post modify the post data towards http://httpbin.org/post
start proyx:
anyproxy --rule sample_modify_request_data.js
test: 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: expected response:
{ "data": "i-am-anyproxy-modified-post-data" } { "data": "i-am-anyproxy-modified-post-data" }
*/</span> */</span>
<span class="hljs-built_in">module</span>.exports = { <span class="hljs-built_in">module</span>.exports = {
*beforeSendRequest(requestDetail) { *beforeSendRequest(requestDetail) {
<span class="hljs-keyword">if</span> (requestDetail.url.indexOf(<span class="hljs-string">'http://httpbin.org'</span>) === <span class="hljs-number">0</span>) { <span class="hljs-keyword">if</span> (requestDetail.url.indexOf(<span class="hljs-string">'http://httpbin.org/post'</span>) === <span class="hljs-number">0</span>) {
<span class="hljs-keyword">const</span> newRequestOptions = requestDetail.requestOptions;
newRequestOptions.headers[<span class="hljs-string">'User-Agent'</span>] = <span class="hljs-string">'AnyProxy/0.0.0'</span>;
<span class="hljs-keyword">return</span> { <span class="hljs-keyword">return</span> {
<span class="hljs-attr">requestOptions</span>: newRequestOptions <span class="hljs-attr">requestData</span>: <span class="hljs-string">'i-am-anyproxy-modified-post-data'</span>
}; };
} }
}, },
@ -413,8 +404,6 @@ newResponse.body += <span class="hljs-string">'--from anyproxy--'</span>;
<pre class="hljs"><code>anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_request_path.js</code></pre><pre class="hljs"><code><span class="hljs-comment">/* <pre class="hljs"><code>anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_request_path.js</code></pre><pre class="hljs"><code><span class="hljs-comment">/*
sample: sample:
redirect all httpbin.org requests to http://httpbin.org/user-agent redirect all httpbin.org requests to http://httpbin.org/user-agent
start proyx:
anyproxy --rule sample_modify_request_path.js
test: test:
curl http://httpbin.org/any-path --proxy http://127.0.0.1:8001 curl http://httpbin.org/any-path --proxy http://127.0.0.1:8001
expected response: expected response:
@ -438,8 +427,6 @@ newResponse.body += <span class="hljs-string">'--from anyproxy--'</span>;
<pre class="hljs"><code>anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_request_protocol.js</code></pre><pre class="hljs"><code><span class="hljs-comment">/* <pre class="hljs"><code>anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_request_protocol.js</code></pre><pre class="hljs"><code><span class="hljs-comment">/*
sample: sample:
redirect all http requests of httpbin.org to https redirect all http requests of httpbin.org to https
start proyx:
anyproxy --rule sample_modify_request_protocol.js
test: test:
curl 'http://httpbin.org/get?show_env=1' --proxy http://127.0.0.1:8001 curl 'http://httpbin.org/get?show_env=1' --proxy http://127.0.0.1:8001
expected response: expected response:
@ -463,8 +450,6 @@ newResponse.body += <span class="hljs-string">'--from anyproxy--'</span>;
<pre class="hljs"><code>anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_response_statuscode.js</code></pre><pre class="hljs"><code><span class="hljs-comment">/* <pre class="hljs"><code>anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_response_statuscode.js</code></pre><pre class="hljs"><code><span class="hljs-comment">/*
sample: sample:
modify all status code of http://httpbin.org/ to 404 modify all status code of http://httpbin.org/ to 404
start proyx:
anyproxy --rule sample_modify_response_statuscode.js
test: test:
curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001 curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001
expected response: expected response:
@ -487,8 +472,6 @@ newResponse.body += <span class="hljs-string">'--from anyproxy--'</span>;
<pre class="hljs"><code>anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_response_header.js</code></pre><pre class="hljs"><code><span class="hljs-comment">/* <pre class="hljs"><code>anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_response_header.js</code></pre><pre class="hljs"><code><span class="hljs-comment">/*
sample: sample:
modify response header of http://httpbin.org/user-agent modify response header of http://httpbin.org/user-agent
start proyx:
anyproxy --rule sample_modify_response_header.js
test: test:
curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001 curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001
expected response: expected response:
@ -511,8 +494,6 @@ newResponse.body += <span class="hljs-string">'--from anyproxy--'</span>;
<pre class="hljs"><code>anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_response_data.js</code></pre><pre class="hljs"><code><span class="hljs-comment">/* <pre class="hljs"><code>anyproxy --rule https://raw.githubusercontent.com/alibaba/anyproxy/4.x/rule_sample/sample_modify_response_data.js</code></pre><pre class="hljs"><code><span class="hljs-comment">/*
sample: sample:
modify response data of http://httpbin.org/user-agent modify response data of http://httpbin.org/user-agent
start proyx:
anyproxy --rule sample.js
test: test:
curl 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001 curl 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001
expected response: expected response: