Skip to content

Commit 7294e3f

Browse files
committed
Merge pull request #15 from Skadabr/master
adding remapHost method
2 parents 71733a9 + e5afc7a commit 7294e3f

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,4 +363,15 @@ Full API
363363
* Headers to set
364364
* CALLBACK(ERROR) function
365365
1. ERROR string if there was an error
366-
366+
367+
**remapHosts(PORT, '{"example.com": "1.2.3.4"}', CALLBACK)**
368+
369+
Overrides normal DNS lookups and remaps the given hosts with the associated IP address
370+
Payload data should be json encoded set of name/value pairs (ex: {"example.com": "1.2.3.4"})
371+
372+
PARAMETERS:
373+
374+
* PORT of proxy for this command
375+
* Hosts to remap
376+
* CALLBACK(ERROR) function
377+
1. ERROR string if there was an error

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ Proxy.prototype = {
227227
req.write(postData);
228228
}
229229
req.end();
230+
},
231+
232+
remapHosts: function (port, postData, cb) {
233+
this.doReq('POST', '/proxy/' + port + '/hosts', postData, cb)
230234
}
231235
};
232236

0 commit comments

Comments
 (0)