Skip to content

Instantly share code, notes, and snippets.

@zzen
Created April 10, 2012 17:58
Show Gist options
  • Save zzen/2353261 to your computer and use it in GitHub Desktop.
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
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