Skip to content

Commit cf1d142

Browse files
author
Tristan Davies
committed
Test forever with pool, thanks to @simov
1 parent e5a5bab commit cf1d142

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

‎tests/test-pool.js‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,34 @@ tape('pool', function(t) {
3030
})
3131
})
3232

33+
tape('forever', function(t) {
34+
var r = request({
35+
url: 'http://localhost:6767',
36+
forever: true,
37+
pool: {maxSockets: 1024}
38+
}, function(err, res, body) {
39+
// explicitly shut down the agent
40+
if (r.agent.destroy === typeof 'function') {
41+
r.agent.destroy()
42+
} else {
43+
// node < 0.12
44+
Object.keys(r.agent.sockets).forEach(function (name) {
45+
r.agent.sockets[name].forEach(function (socket) {
46+
socket.end()
47+
})
48+
})
49+
}
50+
51+
t.equal(err, null)
52+
t.equal(res.statusCode, 200)
53+
t.equal(body, 'asdf')
54+
55+
var agent = res.request.agent
56+
t.equal(agent.maxSockets, 1024)
57+
t.end()
58+
})
59+
})
60+
3361
tape('cleanup', function(t) {
3462
s.close(function() {
3563
t.end()

0 commit comments

Comments
 (0)