test: update test-http-request-dont-override-options to use common.mustCall
PR-URL: https://github.com/nodejs/node/pull/17438 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
50afd901ea
commit
00c5b06317
@ -4,14 +4,13 @@ const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
|
||||
let requests = 0;
|
||||
|
||||
http.createServer(function(req, res) {
|
||||
const server = http.createServer(common.mustCall(function(req, res) {
|
||||
res.writeHead(200);
|
||||
res.end('ok');
|
||||
}));
|
||||
|
||||
requests++;
|
||||
}).listen(0, function() {
|
||||
server.listen(0, function() {
|
||||
const agent = new http.Agent();
|
||||
agent.defaultPort = this.address().port;
|
||||
|
||||
@ -30,16 +29,12 @@ http.createServer(function(req, res) {
|
||||
|
||||
http.request(options, function(res) {
|
||||
res.resume();
|
||||
}).end();
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.strictEqual(requests, 1);
|
||||
|
||||
server.close();
|
||||
assert.strictEqual(options.host, undefined);
|
||||
assert.strictEqual(options.hostname, common.localhostIPv4);
|
||||
assert.strictEqual(options.port, undefined);
|
||||
assert.strictEqual(options.defaultPort, undefined);
|
||||
assert.strictEqual(options.path, undefined);
|
||||
assert.strictEqual(options.method, undefined);
|
||||
});
|
||||
}).unref();
|
||||
}).end();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user