0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00
nodejs/test/parallel/test-http-request-dont-override-options.js
Rich Trott 5b2a8053cb test: remove blank lines at end of files
In preparation for a lint rule that disallows empty lines at the end of
a file, remove such lines from a number of test files.

Refs: https://github.com/nodejs/node/issues/8918
PR-URL: https://github.com/nodejs/node/pull/8920
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-10-05 21:06:36 -07:00

46 lines
1.1 KiB
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const http = require('http');
var requests = 0;
http.createServer(function(req, res) {
res.writeHead(200);
res.end('ok');
requests++;
}).listen(0, function() {
var agent = new http.Agent();
agent.defaultPort = this.address().port;
// options marked as explicitly undefined for readability
// in this test, they should STAY undefined as options should not
// be mutable / modified
var options = {
host: undefined,
hostname: common.localhostIPv4,
port: undefined,
defaultPort: undefined,
path: undefined,
method: undefined,
agent: agent
};
http.request(options, function(res) {
res.resume();
}).end();
process.on('exit', function() {
assert.equal(requests, 1);
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();