Permalink
Browse files

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>
  • Loading branch information...
1 parent adc9ab1 commit 155e6ee270924d5698d3fea37cefc1926cbaf998 @timshadel timshadel committed Jun 6, 2012
Showing with 18 additions and 1 deletion.
  1. +1 −1 main.js
  2. +1 −0 tests/run.js
  3. +16 −0 tests/test-pool.js
View
2 main.js
@@ -108,7 +108,7 @@ Request.prototype.init = function (options) {
if (!options) options = {}
- if (!self.pool) self.pool = globalPool
+ if (!self.pool && self.pool !== false) self.pool = globalPool
self.dests = []
self.__isRequestRequest = true
View
1 tests/run.js
@@ -14,6 +14,7 @@ var tests = [
, 'test-https-strict.js'
, 'test-oauth.js'
, 'test-pipes.js'
+ , 'test-pool.js'
, 'test-proxy.js'
, 'test-qs.js'
, 'test-redirect.js'
View
16 tests/test-pool.js
@@ -0,0 +1,16 @@
+var request = require('../main')
+ , http = require('http')
+ , assert = require('assert')
+ ;
+
+var s = http.createServer(function (req, resp) {
+ resp.statusCode = 200;
+ resp.end('asdf');
+}).listen(8080, function () {
+ request({'url': 'http://localhost:8080', 'pool': false}, function (e, resp) {
+ var agent = resp.request.agent;
+ assert.strictEqual(typeof agent, 'boolean');
+ assert.strictEqual(agent, false);
+ s.close();
+ });
+});

0 comments on commit 155e6ee

Please sign in to comment.