Plato on Github
Report Home
request/tests/test-agent.js
Maintainability
83.22
Lines of code
35
Difficulty
6.72
Estimated Errors
0.23
Function weight
By Complexity
By SLOC
'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() }) })