Skip to content

Commit

Permalink
http: use kEmptyObject
Browse files Browse the repository at this point in the history
PR-URL: #43159
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
LiviaMedeiros authored and danielleadams committed Jun 13, 2022
1 parent 63bf49b commit a4409f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/_http_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 += ':';
Expand Down
7 changes: 5 additions & 2 deletions lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit a4409f8

Please sign in to comment.