Skip to content

Commit a4409f8

Browse files
LiviaMedeirosdanielleadams
authored andcommitted
http: use kEmptyObject
PR-URL: #43159 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 63bf49b commit a4409f8

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lib/_http_agent.js

+5-2
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,
@@ -220,7 +223,7 @@ Agent.defaultMaxSockets = Infinity;
220223
Agent.prototype.createConnection = net.createConnection;
221224

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

226229
name += ':';

lib/_http_client.js

+5-2
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,
@@ -133,7 +136,7 @@ function ClientRequest(input, options, cb) {
133136

134137
if (typeof options === 'function') {
135138
cb = options;
136-
options = input || {};
139+
options = input || kEmptyObject;
137140
} else {
138141
options = ObjectAssign(input || {}, options);
139142
}

0 commit comments

Comments
 (0)