I just installed Node.js and perhaps I'm missing something but I'm trying a simple http.request and get nothing but 400 responses. I've tried several hosts with no luck. I installed Node from their site, this didn't work, so I uninstalled and installed via Homebrew and get the same output of "400". I'm specifically wondering if there's something I need to change on my Mac to allow Node to send requests.
OSX 10.8.4 Node 0.10.13 Homebrew 0.9.4
var http = require("http");
var req = http.request({
host: "http://google.com"
}, function(res){
if (res.statusCode === 200) console.log(res);
else console.log(res.statusCode);
});
req.on("error", function(err){
console.log(err);
});
req.end();
I appreciate any help. Thanks!