From 12cd13312b1bd1ea1642c0058bbc14be72c347f0 Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 7 Aug 2013 10:23:45 -0700 Subject: [PATCH] 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. --- lib/_http_agent.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/_http_agent.js b/lib/_http_agent.js index 3af18a051c4..f973c344257 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -128,6 +128,15 @@ Agent.prototype.getName = function(options) { }; Agent.prototype.addRequest = function(req, options) { + // Legacy API: addRequest(req, host, port, path) + if (typeof options === 'string') { + options = { + host: options, + port: arguments[2], + path: arguments[3] + }; + } + var host = options.host; var port = options.port; var localAddress = options.localAddress;