Skip to content

Commit ae668c1

Browse files
committed
http: added new test
1 parent 2e3e148 commit ae668c1

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
const assert = require('assert');
5+
const http = require('http');
6+
7+
const server = http.createServer(function (req, res) {
8+
res.writeHead(200);
9+
res.end();
10+
});
11+
12+
server.listen(0, common.mustCall(() => {
13+
const req = http.get({ port: server.address().port }, (res) => {
14+
assert.strictEqual(res.statusCode, 200);
15+
16+
res.resume();
17+
server.close();
18+
});
19+
20+
req.end();
21+
}));
22+
23+
// This timer should never go off as the server will close the socket
24+
setTimeout(common.mustNotCall(), 1000).unref();

0 commit comments

Comments
 (0)