Skip to content

Instantly share code, notes, and snippets.

@Marak
Created February 24, 2010 04:54
Show Gist options
  • Save Marak/313115 to your computer and use it in GitHub Desktop.
Save Marak/313115 to your computer and use it in GitHub Desktop.
hookIO.createHttpClient = function(options){
sys.puts('i should be an event that does an http request for ' + JSON.stringify(options));
var google = http.createClient(80, options.host);
var request = google.request("GET", options.path, {"host": options.host});
request.addListener('response', function (response) {
//sys.puts("HTTP REQUEST STATUS CODE: " + response.statusCode);
//sys.puts("HEADERS: " + JSON.stringify(response.headers));
response.setBodyEncoding("utf8");
response.addListener("data", function (chunk) {
// ignore response for now
//sys.puts("BODY: " + chunk);
});
});
request.close();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment