Permalink
Browse files

Added test for post redirect

  • Loading branch information...
1 parent d0c8263 commit d2490425a5ba53af84a59e9f0feb660ed48564f4 @irony irony committed Mar 28, 2012
Showing with 24 additions and 0 deletions.
  1. +24 −0 test/request.test.js
View
@@ -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();

0 comments on commit d249042

Please sign in to comment.