diff --git a/doc/api/http.markdown b/doc/api/http.markdown index e818582a9f..b21314b038 100644 --- a/doc/api/http.markdown +++ b/doc/api/http.markdown @@ -394,11 +394,12 @@ Example: ## http.Agent +## http.getAgent(host, port) `http.request()` uses a special `Agent` for managing multiple connections to an HTTP server. Normally `Agent` instances should not be exposed to user code, however in certain situations it's useful to check the status of the -agent. +agent. The `http.getAgent()` function allows you to access the agents. ### Event: 'upgrade' diff --git a/lib/http.js b/lib/http.js index 6e4a066de3..17b8f00cac 100644 --- a/lib/http.js +++ b/lib/http.js @@ -1148,6 +1148,7 @@ function getAgent(host, port) { return agent; } +exports.getAgent = getAgent; exports._requestFromAgent = function(agent, options, cb) { diff --git a/lib/https.js b/lib/https.js index aaa070a7aa..1b161e6a69 100644 --- a/lib/https.js +++ b/lib/https.js @@ -55,6 +55,7 @@ function getAgent(options) { return agent; } +exports.getAgent = getAgent; exports.request = function(options, cb) {