Even when adding followAllRedirects
only changes response.statusCode
from 302
to 200
but the body
remains the content of the previous response and all the other properties of the response
reflect the old one.
Note: I'm doing these in tests using grunt.
Any reason why redirects aren't followed?
It's written in the docs https://github.com/mikeal/request#requestjar:
Cookies are disabled by default (else, they would be used in subsequent requests). To enable cookies, set jar to true (either in defaults or options).
var request = request.defaults({jar: true})
request('http://www.google.com', function () {
request('http://images.google.com')
})