1 var request = require('../index')
2 , http = require('http')
3 , server = require('./server')
4 , assert = require('assert')
7 var s = http.createServer(function (req, resp) {
10 }).listen(6767, function () {
11 // requests without agentOptions should use global agent
12 var r = request('http://localhost:6767', function (e, resp, body) {
13 assert.deepEqual(r.agent, http.globalAgent);
14 assert.equal(Object.keys(r.pool).length, 0);
16 // requests with agentOptions should apply agentOptions to new agent in pool
17 var r2 = request('http://localhost:6767', { agentOptions: { foo: 'bar' } }, function (e, resp, body) {
18 assert.deepEqual(r2.agent.options, { foo: 'bar' });
19 assert.equal(Object.keys(r2.pool).length, 1);