Skip to content

Instantly share code, notes, and snippets.

@novemberborn
Created December 19, 2010 16:13
Show Gist options
  • Save novemberborn/747439 to your computer and use it in GitHub Desktop.
Save novemberborn/747439 to your computer and use it in GitHub Desktop.
HTTP response parsing errors are emitted from the client, not the response object
require("net").createServer(function(stream){
stream.end("INVALID\r\n\r\nhttp");
}).listen(8080, "127.0.0.1");
require("http").createClient(8080, "127.0.0.1")
.on("error", function(err){
console.error("Client error\n%s", err.stack);
})
.request("GET", "/", {}).on("response", function(){ console.log("Got response"); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment