Document request options in one place
Per discussion in https://github.com/orgs/mdn/discussions/694.
I've been through the fetch() and Request() pages, incorporating what seemed useful, correcting what seem to be some errors[1] and adding some more detail. Also being more consistent about describing default values.
I think in some ways this goes alongside https://github.com/mdn/content/pull/34278, in that it would be nice to point to a usage guide for some of these options.
[1] e.g. that no-referrer passed into referrer works to omit the Referer header, that seems to be a confusion with referrerPolicy, or that "the Origin header is not set on Fetch requests with a method of HEAD or GET", which only seems to be true for same-origin requests.
Fixes #33356. Fixes #13063.
Preview URLs
-
/en-US/docs/Web/API/Request/Request -
/en-US/docs/Web/API/Request/credentials -
/en-US/docs/Web/API/RequestInit -
/en-US/docs/Web/API/fetch
(comment last updated: 2024-07-02 14:53:20)
I just pushed https://github.com/mdn/content/pull/34437/commits/0f79e72485bba054915374aeac96a5bd2a56ef1a which I think means we can close https://github.com/mdn/content/issues/13063 in this PR.
Issue https://github.com/mdn/content/issues/13063 has a couple of aspects:
- the page on Access-Control-Allow-Credentials incorrectly said that credentials included "authorization headers". It turns out I fixed that back in https://github.com/mdn/content/pull/31013 , so now the page says that they may be "cookies, TLS client certificates, or authentication headers containing a username and password"
- the page on Request.credentials was unclear/incorrect about this too. Also unrelated to this bug it says things like "whether the user agent should send or receive cookies from the other domain in the case of cross-origin requests" when it's more than just cookies, and more than just cross-origin requests. So in https://github.com/mdn/content/pull/34437/commits/0f79e72485bba054915374aeac96a5bd2a56ef1a I've taken out a lot of that stuff and pointed instead to Including credentials in the Fetch guide, which should be correct. This is also in line with the suggestion in https://github.com/mdn/content/pull/34406 that we ought to have quite minimal docs for these
Requestproperties, since they are just reflections of the option given inRequestInit.
@sideshowbarker , I saw you removed my review request, I wasn't sure if that was because you didn't have time to or because @Josh-Cena was reviewing already. I'd still be very happy to get your review on it but I'm also happier about getting less detailed review since https://github.com/mdn/content/pull/34278 got merged :).
@sideshowbarker , I saw you removed my review request, I wasn't sure if that was because you didn't have time to or because @Josh-Cena was reviewing already.
Yeah, that was the only reason — because it seemed like Josh was already on it.
I'd still be very happy to get your review on it but I'm also happier about getting less detailed review since #34278 got merged :).
I'll go ahead and do a review. It's always possible more eyes might catch something that otherwise for overlooked.