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 90403dd

Browse filesBrowse files
fengmk2jasnell
authored andcommitted
http: should support userland Agent
PR-URL: #11567 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 20b1823 commit 90403dd
Copy full SHA for 90403dd

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+3
-3
lines changed
Open diff view settings
Collapse file

‎lib/_http_client.js‎

Copy file name to clipboardExpand all lines: lib/_http_client.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ function ClientRequest(options, cb) {
8989
}
9090
// Explicitly pass through this statement as agent will not be used
9191
// when createConnection is provided.
92-
} else if (!(agent instanceof Agent.Agent)) {
92+
} else if (typeof agent.addRequest !== 'function') {
9393
throw new TypeError(
94-
'Agent option must be an instance of http.Agent, undefined or false.'
94+
'Agent option must be an Agent-like object, undefined, or false.'
9595
);
9696
}
9797
this.agent = agent;
Collapse file

‎test/parallel/test-http-client-reject-unexpected-agent.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-client-reject-unexpected-agent.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ server.listen(0, baseOptions.host, common.mustCall(function() {
4949
failingAgentOptions.forEach((agent) => {
5050
assert.throws(
5151
() => createRequest(agent),
52-
/^TypeError: Agent option must be an instance of http.Agent/,
52+
/^TypeError: Agent option must be an Agent-like object/,
5353
`Expected typeof agent: ${typeof agent} to be rejected`
5454
);
5555
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.