2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-08 17:22:34 +03:00

Choose between follow-redirects or core

This commit is contained in:
dublx
2016-04-22 15:47:16 +01:00
parent 093593cbca
commit a04077a17d
2 changed files with 46 additions and 5 deletions
+26
View File
@@ -79,6 +79,32 @@ module.exports = {
});
},
testNoRedirect: function (test) {
var str = 'test response';
server = http.createServer(function (req, res) {
var parsed = url.parse(req.url);
if (parsed.pathname === '/one') {
res.setHeader('NoRedirect', 'true');
res.setHeader('Location', '/two');
res.statusCode = 302;
res.end();
} else {
res.end(str);
}
}).listen(4444, function () {
axios.get('http://localhost:4444/one', {
maxRedirects: 0
}).then(function (res) {
test.equal(res.status, 302);
test.equal(res.headers['noredirect'], 'true');
test.equal(res.headers['location'], '/two');
test.done();
});
});
},
testTransparentGunzip: function (test) {
var data = {
firstName: 'Fred',