Skip to content

Commit 12cd133

Browse files
committed
http: Support legacy agent.addRequest API
There are some agent subclasses using this today. Despite the addRequest function being undocumented internal API, it's easy enough to just support the old signature for backwards compatibility.
1 parent d24decb commit 12cd133

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/_http_agent.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,15 @@ Agent.prototype.getName = function(options) {
128128
};
129129

130130
Agent.prototype.addRequest = function(req, options) {
131+
// Legacy API: addRequest(req, host, port, path)
132+
if (typeof options === 'string') {
133+
options = {
134+
host: options,
135+
port: arguments[2],
136+
path: arguments[3]
137+
};
138+
}
139+
131140
var host = options.host;
132141
var port = options.port;
133142
var localAddress = options.localAddress;

0 commit comments

Comments
 (0)