diff --git a/package.json b/package.json index f649844ff..7ff888d6b 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "dependencies": { "bl": "~0.9.0", "caseless": "~0.9.0", - "forever-agent": "~0.5.0", + "forever-agent": "~0.6.0", "form-data": "~0.2.0", "json-stringify-safe": "~5.0.0", "mime-types": "~2.0.1", diff --git a/tests/test-agent.js b/tests/test-agent.js new file mode 100644 index 000000000..cca03d410 --- /dev/null +++ b/tests/test-agent.js @@ -0,0 +1,35 @@ +'use strict' + +var request = require('../index') + , http = require('http') + , tape = require('tape') + +var s = http.createServer(function(req, res) { + res.statusCode = 200 + res.end('ok') +}) + +tape('setup', function(t) { + s.listen(6767, function() { + t.end() + }) +}) + +tape('should work with forever agent', function(t) { + var r = request.forever({maxSockets: 1}) + + r({ + url: 'http://localhost:6767', + headers: { 'Connection':'Close' } + }, function(err, resp, body) { + t.equal(err, null) + t.equal(body, 'ok') + t.end() + }) +}) + +tape('cleanup', function(t) { + s.close(function() { + t.end() + }) +})