blob: 623b253a20e667fe0501f160a9ab71fe29408d62 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
'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);
});
}));
});
|