Created
April 10, 2012 17:58
-
-
Save zzen/2353261 to your computer and use it in GitHub Desktop.
Why does the http.request() hang indefinitely? Am I missing other required params? See http://nodejs.org/docs/v0.6.10/api/http.html#http.request
This file contains 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'); | |
// This works! | |
http.get({ | |
host: 'www.google.com', | |
port: 80, | |
path: '/' | |
}, function(res) { console.error("First result",res.statusCode); }); | |
// This doesn't! | |
http.request({ | |
host: 'www.google.com', | |
port: 80, | |
path: '/' | |
}, function(res) { return console.error("Second result",res.statusCode); }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment