Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
var http = require('http');
var assert = require('assert');
var options = {
method: 'GET',
port: 3000,
host: '127.0.0.1',
path: '/'
};
var server = http.createServer(function(req, res) {
res.writeHead(200, {'Content-Length':'2'});
setTimeout(function() { res.write('*'); res.end('*') }, 20);
});
server.listen(options.port, options.host, function() {
var req = http.request(options, onresponse);
var timeout = false;
req.setTimeout(10, function() {
timeout = true;
});
req.end();
function onresponse(res) {
assert.ok(!timeout, 'Ouch');
res.on('data', function(data) {
});
res.on('end', function() {
server.close();
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.