Skip to content

Instantly share code, notes, and snippets.

@koichik
Created May 2, 2012 09:33
Show Gist options
  • Save koichik/2575536 to your computer and use it in GitHub Desktop.
Save koichik/2575536 to your computer and use it in GitHub Desktop.
reproduce @lorenwest of #2997
var net = require('net');
var http = require('http');
var server = net.createServer(function(socket) {
socket.write('HTTP/1.1 204 No Content\r\n\r\nNo Content');
}).listen(3000, function() {
var req = http.get({port: 3000}, function(res) {
console.log('got response', res.statusCode);
res.on('end', function() {
console.log('end response');
});
res.on('error', function(err) {
console.log('could not catch here, because this response is ended', err);
});
});
req.on('error', function(err) {
console.log('could not catch here, because this request is ended', err);
});
});
process.on('uncaughtException', function(err) {
console.log('we can catch error here', err);
server.close();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment