mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +00:00
http: use kEmptyObject
PR-URL: https://github.com/nodejs/node/pull/43159 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
parent
c52454fdc3
commit
a709a7155d
@ -54,7 +54,10 @@ const {
|
||||
ERR_OUT_OF_RANGE,
|
||||
},
|
||||
} = require('internal/errors');
|
||||
const { once } = require('internal/util');
|
||||
const {
|
||||
kEmptyObject,
|
||||
once,
|
||||
} = require('internal/util');
|
||||
const {
|
||||
validateNumber,
|
||||
validateOneOf,
|
||||
@ -220,7 +223,7 @@ Agent.defaultMaxSockets = Infinity;
|
||||
Agent.prototype.createConnection = net.createConnection;
|
||||
|
||||
// Get the key for a given set of request options
|
||||
Agent.prototype.getName = function getName(options = {}) {
|
||||
Agent.prototype.getName = function getName(options = kEmptyObject) {
|
||||
let name = options.host || 'localhost';
|
||||
|
||||
name += ':';
|
||||
|
||||
@ -43,7 +43,10 @@ const {
|
||||
|
||||
const net = require('net');
|
||||
const assert = require('internal/assert');
|
||||
const { once } = require('internal/util');
|
||||
const {
|
||||
kEmptyObject,
|
||||
once,
|
||||
} = require('internal/util');
|
||||
const {
|
||||
_checkIsHttpToken: checkIsHttpToken,
|
||||
freeParser,
|
||||
@ -133,7 +136,7 @@ function ClientRequest(input, options, cb) {
|
||||
|
||||
if (typeof options === 'function') {
|
||||
cb = options;
|
||||
options = input || {};
|
||||
options = input || kEmptyObject;
|
||||
} else {
|
||||
options = ObjectAssign(input || {}, options);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user