Closed zazabe closed 9 years ago
I had other problem by removing the jar
option within request.js
file, responses from multiple requests were randomly permutated.
To solve this issue, in a 302 with cookie redirect, I have to set jar = request.jar()
:
request.js
in node.io, ~290:
...
//Set a request timeout?
if (this.options.timeout) {
self.cancel_timeout();
options.timeout = this.options.timeout * 1000;
}
// change jar from "false" to a new jar instance
options.jar = request.jar();
request(options, function (err, response, body) {
...
Hope it can help somebody or it can be fixed in node.io.
If I produce any side effect by doing this, please, tell me !
Thanks
Hi,
I get some troubles when I try to scrape a website doing a 302 redirection and setting a cookie. It's seems that, because request
options.jar
is hardcoded tofalse
inrequest.js
, the cookie is not correctly set after the redirection... and the content of my page is not what i expected... I did some tests by removing this hardcodedjar: false
option, everything work nice after.A small test showing the problem:
In this case, the redirection never end because the cookie is not set by the redirect.
Not sure it's a bug but I have no other solution than removing the
jar
option in your code, there's some side effect by doing this ?PS: beside this, for my POST request, I have to explicity set the header property
Content-Type: application/x-www-form-urlencoded
, should it not be done automatically ?Thanks, hope my questions make sense...