Created
February 5, 2014 11:56
-
-
Save squareproton/8822158 to your computer and use it in GitHub Desktop.
restify proof of concept bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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