-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fetch(..., {redirect: 'manual'}) does not work propertly #4389
Comments
Ref #3767 |
I'm pretty sure this is currently the intended behaviour? https://fetch.spec.whatwg.org/#concept-request-redirect-mode says
Fixing #3767 should basically provide the same user accessible API as I understand it. I think want @jakajancar wants is something like the https://stackoverflow.com/a/42717388 explains why Also, @bartlomieju I'm not really available to help with deno right now, as I unfortunately have school work that is higher priority. I am sorry about this, because I know that there are a few fetch issues that have yet to be resolved, but there's not much I can do right now. |
Thanks @serverhiccups for the context. My thinking is the server will always have slightly different use-cases and does not need the same CORS limitations as the browser. I see these options:
no-securityIf there is a real benefit to emulate browser security behavior on the server-side, and indeed if such concepts as Origin even make sense, and if Deno has the capacity to do this, then I would propose 3.2: The modes currently are:
Such
This would be great for testing APIs as well as making requests that are perfectly OK from the server/app, but not the browser context. LooseIf Deno emulating browser limitations fully is either useless OR non-realistic, I would just go with option 2 and remove these limitations. Maybe this can be said to be |
I'm a little confused about what you are trying to achieve here. To answer the original issue, |
Yes exactly. Handle redirection myself (or, not really handle it, just check that it happened and correct Location header was returned).
... returning the full 302 response is my suggestion. |
I do like the idea of I'm not sure how much work would be involved in implementing this and whether or not we want to diverge from the spec (pinging @bartlomieju), but if it's only a little I might be able to get it done. |
I think you are looking too narrowly. What if I want to do a PUT without preflight? All the CORS stuff needs a solution, not just redirect. |
Hey, I'm affected by this issue as well. I'm trying to log into a service using fetch, but I can't access its headers since it redirects to the main page with a 302 status code. When using node-fetch in Node, you can set the redirect option to manual, which makes it so it simply doesn't redirect and allows you to access the headers, status, etc. In Deno this gives you a status code of 0, with a body of null and empty headers. I know this isn't how the standard fetch does it, but it's a lot more useful this way. Is there a way to access this information using fetch? Or any other solution for this? |
https://httpbin.org/status/302
is a url that does a few redirects, ending athttps://httpbin.org/get
.Follows redirects, prints status 200, headers, as expected.
Prints status 0, empty headers.
Expected: status 302, headers including
Location
.The text was updated successfully, but these errors were encountered: