Skip to content

Instantly share code, notes, and snippets.

@chakrit
Created April 6, 2013 09:01
Show Gist options
  • Save chakrit/5325483 to your computer and use it in GitHub Desktop.
Save chakrit/5325483 to your computer and use it in GitHub Desktop.
Testing `end` event for response.
var http = require('http');
http.createServer(function(req, resp) {
console.log('incoming request');
resp.once('end', function() {
throw new Error('response is done');
});
setTimeout(function() {
resp.end('hi!');
}, 1000);
}).listen(6789);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment