Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d8018bc

Browse filesBrowse files
mithunsasidharanMylesBorins
authored andcommitted
test: update test-http-request-dont-override-options to use common.mustCall
PR-URL: #17438 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 0ac87c2 commit d8018bc
Copy full SHA for d8018bc

File tree

Expand file treeCollapse file tree

1 file changed

+6
-11
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-11
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-http-request-dont-override-options.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-request-dont-override-options.js
+6-11Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ const common = require('../common');
44
const assert = require('assert');
55
const http = require('http');
66

7-
let requests = 0;
87

9-
http.createServer(function(req, res) {
8+
const server = http.createServer(common.mustCall(function(req, res) {
109
res.writeHead(200);
1110
res.end('ok');
11+
}));
1212

13-
requests++;
14-
}).listen(0, function() {
13+
server.listen(0, function() {
1514
const agent = new http.Agent();
1615
agent.defaultPort = this.address().port;
1716

@@ -30,16 +29,12 @@ http.createServer(function(req, res) {
3029

3130
http.request(options, function(res) {
3231
res.resume();
33-
}).end();
34-
35-
process.on('exit', function() {
36-
assert.strictEqual(requests, 1);
37-
32+
server.close();
3833
assert.strictEqual(options.host, undefined);
3934
assert.strictEqual(options.hostname, common.localhostIPv4);
4035
assert.strictEqual(options.port, undefined);
4136
assert.strictEqual(options.defaultPort, undefined);
4237
assert.strictEqual(options.path, undefined);
4338
assert.strictEqual(options.method, undefined);
44-
});
45-
}).unref();
39+
}).end();
40+
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.