Skip to content

Commit

Permalink
Added test for post redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
irony committed Mar 28, 2012
1 parent d0c8263 commit d249042
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/request.test.js
Expand Up @@ -342,6 +342,30 @@ module.exports = {
}, timeout);
},


'test POST request with too many redirects': function() {

var job = createJob({followAllRedirects : true});

var server = http.createServer(function (req, res) {
res.writeHead(302, {'Content-Type': 'text/plain', 'Location': '/'});
res.end();
});

server.listen(++port);

job.post('http://127.0.0.1:'+port+'/', {foo:'bar'}, function(err, data, headers) {
assert.equal('redirects', err);
assert.equal(null, data);
close(server);
});

setTimeout(function() {
close(server);
}, timeout);
},


'test get() is in same scope as job': function() {

var job = createJob();
Expand Down

0 comments on commit d249042

Please sign in to comment.