Created
January 22, 2016 00:50
-
-
Save daguej/13a712bdf2db1a23862f to your computer and use it in GitHub Desktop.
request leak test
This file contains 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
var request = require('request'), | |
fs = require('fs'); | |
request({ | |
url: 'http://localhost:5555/r/' + process.argv[2] | |
}, function(err, res, body) { | |
console.log(err, res && res.statusCode, body); | |
}); |
This file contains 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
var express = require('express'), | |
app = express(); | |
app.get('/r/:n', function(req, res) { | |
var n = parseInt(req.params.n); | |
setTimeout(function() { | |
if (n < 15) { | |
res.redirect('/r/' + (n+1)); | |
} else { | |
res.send('ok'); | |
} | |
}, 100); | |
}); | |
app.listen(5555); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See request/request#2028