You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

30 lines
638 B

'use strict';
const common = require('../common');
const http = require('http');
const options = {
method: 'GET',
port: undefined,
host: '127.0.0.1',
path: '/'
};
const server = http.createServer();
server.listen(0, options.host, function() {
options.port = this.address().port;
const req = http.request(options);
req.on('error', function() {
// this space is intentionally left blank
});
req.on('close', common.mustCall(() => server.close()));
req.setTimeout(1);
req.on('timeout', common.mustCall(() => {
req.end(() => {
setTimeout(() => {
req.destroy();
}, 100);
});
}));
});