Skip to content

Commit d65d99d

Browse files
LiviaMedeirosguangwong
authored andcommitted
http: use kEmptyObject
PR-URL: nodejs/node#43159 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent 0a985b0 commit d65d99d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lib/_http_agent.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ const {
5454
ERR_OUT_OF_RANGE,
5555
},
5656
} = require('internal/errors');
57-
const { once } = require('internal/util');
57+
const {
58+
kEmptyObject,
59+
once,
60+
} = require('internal/util');
5861
const {
5962
validateNumber,
6063
validateOneOf,
@@ -217,7 +220,7 @@ Agent.defaultMaxSockets = Infinity;
217220
Agent.prototype.createConnection = net.createConnection;
218221

219222
// Get the key for a given set of request options
220-
Agent.prototype.getName = function getName(options = {}) {
223+
Agent.prototype.getName = function getName(options = kEmptyObject) {
221224
let name = options.host || 'localhost';
222225

223226
name += ':';

lib/_http_client.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ const {
4343

4444
const net = require('net');
4545
const assert = require('internal/assert');
46-
const { once } = require('internal/util');
46+
const {
47+
kEmptyObject,
48+
once,
49+
} = require('internal/util');
4750
const {
4851
_checkIsHttpToken: checkIsHttpToken,
4952
freeParser,
@@ -127,7 +130,7 @@ function ClientRequest(input, options, cb) {
127130

128131
if (typeof options === 'function') {
129132
cb = options;
130-
options = input || {};
133+
options = input || kEmptyObject;
131134
} else {
132135
options = ObjectAssign(input || {}, options);
133136
}

0 commit comments

Comments
 (0)