diff --git a/index.html b/index.html index d3c1b49..a55009c 100644 --- a/index.html +++ b/index.html @@ -114,14 +114,14 @@
-module.exports = {
+module.exports = {
     /*
     these functions will overwrite the default ones, write your own when necessary.
     */
 
     //whether to intercept this request by local logic
     //if the return value is true, anyproxy will call dealLocalResponse to get response data and will not send request to remote server anymore
-    shouldUseLocalResponse : function(req,reqBody){
+    shouldUseLocalResponse : function(req,reqBody){
         return false;
     },
 
@@ -129,14 +129,14 @@
     //this function be called when shouldUseLocalResponse returns true
     //callback(statusCode,resHeader,responseData)
     //e.g. callback(200,{"content-type":"text/html"},"hello world")
-    dealLocalResponse : function(req,reqBody,callback){
+    dealLocalResponse : function(req,reqBody,callback){
         callback(statusCode,resHeader,responseData)
     },
 
     //replace the request protocol when sending to the real server
     //protocol : "http" or "https"
-    replaceRequestProtocol:function(req,protocol){
-        var newProtocol = protocol;
+    replaceRequestProtocol:function(req,protocol){
+        var newProtocol = protocol;
         return newProtocol;
     },
 
@@ -144,44 +144,44 @@
     //option is how the proxy server will send request to the real server. i.e. require("http").request(option,function(){...})
     //you may return a customized option to replace the original option
     //you should not write content-length header in options, since anyproxy will handle it for you
-    replaceRequestOption : function(req,option){
-        var newOption = option;
+    replaceRequestOption : function(req,option){
+        var newOption = option;
         return newOption;
     },
 
     //replace the request body
-    replaceRequestData: function(req,data){
+    replaceRequestData: function(req,data){
         return data;
     },
 
     //replace the statusCode before it's sent to the user
-    replaceResponseStatusCode: function(req,res,statusCode){
-        var newStatusCode = statusCode;
+    replaceResponseStatusCode: function(req,res,statusCode){
+        var newStatusCode = statusCode;
         return newStatusCode;
     },
 
     //replace the httpHeader before it's sent to the user
     //Here header == res.headers
-    replaceResponseHeader: function(req,res,header){
-        var newHeader = header;
+    replaceResponseHeader: function(req,res,header){
+        var newHeader = header;
         return newHeader;
     },
 
     //replace the response from the server before it's sent to the user
     //you may return either a Buffer or a string
     //serverResData is a Buffer, you may get its content by calling serverResData.toString()
-    replaceServerResData: function(req,res,serverResData){
+    replaceServerResData: function(req,res,serverResData){
         return serverResData;
     },
 
     //add a pause before sending response to user
-    pauseBeforeSendingResponse : function(req,res){
-        var timeInMS = 1; //delay all requests for 1ms
+    pauseBeforeSendingResponse : function(req,res){
+        var timeInMS = 1; //delay all requests for 1ms
         return timeInMS; 
     },
 
     //should intercept https request, or it will be forwarded to real server
-    shouldInterceptHttpsReq :function(req){
+    shouldInterceptHttpsReq :function(req){
         return false;
     }
 
@@ -224,10 +224,10 @@
 
npm install anyproxy --save
 
-
var proxy = require("anyproxy");
+
var proxy = require("anyproxy");
 
 !proxy.isRootCAFileExists() && proxy.generateRootCA(); //please manually trust this rootCA
-new proxy.proxyServer("http","8001", "localhost" ,"path/to/rule/file.js");
+new proxy.proxyServer("http","8001", "localhost" ,"path/to/rule/file.js");
 

@@ -248,7 +248,7 @@