Skip to content

Commit

Permalink
test: update test-http-request-dont-override-options to use common.mu…
Browse files Browse the repository at this point in the history
…stCall

PR-URL: #17438
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
mithunsasidharan authored and MylesBorins committed Dec 12, 2017
1 parent 0ac87c2 commit d8018bc
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions test/parallel/test-http-request-dont-override-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();
});

0 comments on commit d8018bc

Please sign in to comment.