Skip to content

Commit 155e6ee

Browse files
committed
Fixed pool: false to not use the global agent
An incorrect check caused the `globalPool` to be used whenever the `pool` option was set to `false`. --Tim Shadel <github@timshadel.com>
1 parent adc9ab1 commit 155e6ee

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎main.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Request.prototype.init = function (options) {
108108

109109
if (!options) options = {}
110110

111-
if (!self.pool) self.pool = globalPool
111+
if (!self.pool && self.pool !== false) self.pool = globalPool
112112
self.dests = []
113113
self.__isRequestRequest = true
114114

‎tests/run.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ var tests = [
1414
, 'test-https-strict.js'
1515
, 'test-oauth.js'
1616
, 'test-pipes.js'
17+
, 'test-pool.js'
1718
, 'test-proxy.js'
1819
, 'test-qs.js'
1920
, 'test-redirect.js'

‎tests/test-pool.js‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var request = require('../main')
2+
, http = require('http')
3+
, assert = require('assert')
4+
;
5+
6+
var s = http.createServer(function (req, resp) {
7+
resp.statusCode = 200;
8+
resp.end('asdf');
9+
}).listen(8080, function () {
10+
request({'url': 'http://localhost:8080', 'pool': false}, function (e, resp) {
11+
var agent = resp.request.agent;
12+
assert.strictEqual(typeof agent, 'boolean');
13+
assert.strictEqual(agent, false);
14+
s.close();
15+
});
16+
});

0 commit comments

Comments
 (0)