diff --git a/lib/_http_agent.js b/lib/_http_agent.js index ff2047d4ea81bb..6784e884859986 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -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 += ':'; diff --git a/lib/_http_client.js b/lib/_http_client.js index 59329ff243643d..91906b85a38910 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -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); }