GeezerVison is showing github.com — http: should support userland Agent · nodejs/node@90403dd
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/_http_client.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -89,9 +89,9 @@ function ClientRequest(options, cb) { |
89 | 89 | } |
90 | 90 | // Explicitly pass through this statement as agent will not be used |
91 | 91 | // when createConnection is provided. |
92 | | - } else if (!(agent instanceof Agent.Agent)) { |
| 92 | + } else if (typeof agent.addRequest !== 'function') { |
93 | 93 | 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.' |
95 | 95 | ); |
96 | 96 | } |
97 | 97 | this.agent = agent; |
|
Collapse file
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 number | Diff line number | Diff line change |
|---|
@@ -49,7 +49,7 @@ server.listen(0, baseOptions.host, common.mustCall(function() { |
49 | 49 | failingAgentOptions.forEach((agent) => { |
50 | 50 | assert.throws( |
51 | 51 | () => createRequest(agent), |
52 | | - /^TypeError: Agent option must be an instance of http.Agent/, |
| 52 | + /^TypeError: Agent option must be an Agent-like object/, |
53 | 53 | `Expected typeof agent: ${typeof agent} to be rejected` |
54 | 54 | ); |
55 | 55 | }); |
|