Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

A server with configurable lag for testing

  • Loading branch information...
isaacs committed Mar 7, 2012
1 parent d5fca08 commit 17da4242b0dd8bd45f34d7f1610d83d1036b9e6d
Showing with 13 additions and 0 deletions.
  1. +13 −0 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.
You can’t perform that action at this time.