Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a4409f8

Browse filesBrowse 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
Copy full SHA for a4409f8

File tree

Expand file treeCollapse file tree

2 files changed

+10
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-4
lines changed
Open diff view settings
Collapse file

‎lib/_http_agent.js‎

Copy file name to clipboardExpand all lines: lib/_http_agent.js
+5-2Lines 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,
@@ -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 += ':';
Collapse file

‎lib/_http_client.js‎

Copy file name to clipboardExpand all lines: lib/_http_client.js
+5-2Lines 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,
@@ -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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.