Skip to content

Instantly share code, notes, and snippets.

@coolicer
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coolicer/880c617081503e69de70 to your computer and use it in GitHub Desktop.
Save coolicer/880c617081503e69de70 to your computer and use it in GitHub Desktop.
proxy
if(req.url == '/data/get') {
var post_data = querystring.stringify({
proc: 'getConfig'
});
var options = {
host: '192.168.1.246',
port:80,
path: '/data/get',
method: 'POST',
headers: {
'Content-Length': post_data.length
}
};
var body = ''
var client_req = http.request(options, function(res) {
console.log("Got response: " + res.statusCode);
res
.on('data',function(d){
body += d;
})
.on('end', function(){
console.log(res.headers)
console.log(body)
});
}).on('error', function(e) {
console.log("Got error: " + e.message);
})
client_req.write(post_data)
client_req.end();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment