Skip to content

Instantly share code, notes, and snippets.

@squareproton
Created February 5, 2014 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save squareproton/8822158 to your computer and use it in GitHub Desktop.
Save squareproton/8822158 to your computer and use it in GitHub Desktop.
restify proof of concept bug
// behaviour node v<= 0.8
// fixed node >= 0.10
var restify = require('restify');
function delay (req, res, next) {
setTimeout(function(){
next();
}, 0);
}
function nothing (req, res, next) {
next();
}
function helloWorld (req, res, next) {
res.send({
hello: "world"
});
next();
}
var server = restify.createServer();
server.use(nothing);
server.use(restify.bodyParser());
server.get( '/', helloWorld );
server.listen(4000);
// curl -v 127.0.0.1:4000 returns immediately as expected
var server = restify.createServer();
server.use(delay);
server.use(restify.bodyParser());
server.get( '/', helloWorld );
server.listen(5000);
// curl -v 127.0.0.1:5000 never returns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment