Created
August 7, 2013 17:24
-
-
Save isaacs/6176301 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From fac89367054274d86ccf3fdd0263ade36f1e2bc4 Mon Sep 17 00:00:00 2001 | |
From: isaacs <i@izs.me> | |
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 3af18a0..f973c34 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; | |
-- | |
1.8.3.2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment