Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
A server with configurable lag for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Mar 7, 2012
1 parent d5fca08 commit 17da424
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions benchmark/http_server_lag.js
@@ -0,0 +1,13 @@
var http = require('http');
var port = parseInt(process.env.PORT, 10) || 8000;
var defaultLag = parseInt(process.argv[2], 10) || 100;

http.createServer(function(req, res) {
res.writeHead(200, { 'content-type': 'text/plain',
'content-lengt': '2' });

This comment has been minimized.

Copy link
@mscdex

mscdex Mar 7, 2012

s/content-lengt/content-length/


var lag = parseInt(req.url.split("/").pop(), 10) || defaultLag;
setTimeout(function() {
res.end('ok');
}, lag);
}).listen(port, 'localhost');

0 comments on commit 17da424

Please sign in to comment.