Created
January 4, 2013 10:03
-
-
Save takaheraw/4451403 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var options = { host: 'localhost', | |
port: 1337, | |
path: '/', | |
method: 'POST'}; | |
var req = http.request(options, function(res){ | |
var data = ''; | |
res.on('data', function(chunk){ | |
data += chunk; | |
}); | |
res.on('end', function(){ | |
console.log(data); | |
}); | |
}); | |
var msg = 'Hello from HTTP Client Request'; | |
req.setHeader('Content-Length', Buffer.byteLength(msg)); | |
req.write(msg); | |
req.end(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment