-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't transmit cookies on redirect #4
Comments
Yes, you're right. This is because However, it would be possible to set I'll see when I have time to do that (maybe in a week or so). If you or anyone else wants to do it, PR's are always welcome! :D |
Yes it work with redirect manual but I have many redirect (3 or 4 for each request) so finding the urls and write each request is not very efficient :/ The issue is that you can't get the redirect url from "manual" mode in fetch as this issue say: whatwg/fetch#763 (perhaps it's possible in node-fetch but i didn't find anything about it) |
Really interesting, that there seems to be no way of accessing the headers when using In the following example import fetch from "node-fetch";
(async () => {
const response = await fetch("https://totally.rip/redirect-test/index.php", { redirect: "manual" });
console.log(response.headers.get("location")); // "https://totally.rip/redirect-test/r.php"
})(); So changing the code to manually follow redirects shouldn't be a problem. |
Yes you are right ! |
That would be great! Yes, you can add a while loop to the fetch function or use recursion. Also be sure to not just check for 302 but all other possible redirect status codes as well (node-fetch checks for these). You can also check how node-fetch handles redirects: https://github.com/node-fetch/node-fetch/blob/master/src/index.js#L103 (they're calling |
Your lib doesn't seem to keep the cookies with redirect: "follow"
The text was updated successfully, but these errors were encountered: