http: add default argument for Agent.prototype.getName

PR-URL: https://github.com/nodejs/node/pull/41906
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
This commit is contained in:
小菜
2022-02-27 23:01:01 +08:00
committed by GitHub
parent 0f2ab70542
commit 04c68ba54a
5 changed files with 20 additions and 4 deletions

View File

@@ -217,7 +217,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 = {}) {
let name = options.host || 'localhost';
name += ':';