-
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
[WIP] Make fetch() more standards compliant #3667
[WIP] Make fetch() more standards compliant #3667
Conversation
Oh dear, It seems like the linting is failing, which is weird given that it works on my laptop. 🤔 |
@serverhiccups |
RFC on whether or not we should add a new "nofollow" redirect mode. I'm suggesting this because I'm currently working on a project that requires the ability to view the response of a request that always returns 302. While I know this PR is supposed to be about making |
1c093a8
to
e0d6bb0
Compare
I think that moving the refactoring of the Response object (to properly support the standard and 'internal` responses) to separate issue is a good idea because it would probably significantly delay the rest of this PR. That being said, because Deno doesn't really need to prevent reading the internal states of responses like browser (because we aren't trying to prevent cross-origin requests), our currently solution is probably fine. |
@serverhiccups This PR is looking good - thanks! Looking forward to some tests.
Can you explain what nofollow does? I only know of the |
@ry I probably should have explained it better. |
Perf test is failing now? I'm not sure if that is related to my code... |
0cca597
to
3cef47a
Compare
@serverhiccups I didn't know about these redirect modes. So you need to get the headers for a 3xx response? That seems like a reasonable thing to do... Is it impossible in browsers? I'm hesitant to add non-standard extensions to fetch. Maybe a way forward would be to split this PR into two parts - one where the standard request modes are handled, and then a second which adds a new request mode ("nofollow" is confusing I think, maybe "noredirect"?) |
Redirection behaviour can be controlled by https://developer.mozilla.org/en-US/docs/Web/API/Request/Request |
@ry AFAIK as I know, it is technically possible to not be redirected in browsers. However, both ways of doing it ( @bartlomieju While you can control the redirection mode, you can't actually control it in meaningful ways because the modes that don't redirect don't provide any useful information in the response (See here). I'm going to (hopefully) finish the tests for this PR today and then I'll split the |
@serverhiccups is this PR ready for review? |
f737a75
to
360e2fb
Compare
Now the build is failing :(. Not sure why, doesn't seem to be related to my changes... |
…hiccups/deno into make-fetch-more-compliant
I'm pretty aware that the commit history on this one is pretty ugly, but I'm not entirely sure how to fix it, and I'm just happy it works. |
Also clarify some checks in Response.
I'm pretty sure this is commit is about ready to land. I'm going to create a separate PR for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thank you @serverhiccups - sorry for the delay
Hi all,
This is my first time contributing to this repo (and using typescript), so I'm very open to comments regarding code style/cleanliness.
Currently
fetch
returnsnotImplemented
on many options, so I'm just trying to plug those gaps.The relevant spec is here: https://fetch.spec.whatwg.org/.
Fixes #3660.
To-do list (in no particular order):
nofollow
)Reponse.redirect()
NetworkError
)For later:
- [ ] Refactor the Response object so that we can handle 'internal' headersSee #3767