-
Notifications
You must be signed in to change notification settings - Fork 22.6k
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
feat(http): Add Prefer, Preferrence-Applied headers #37659
base: main
Are you sure you want to change the base?
Conversation
Preview URLs
Flaws (6)Note! 2 documents with no flaws that don't need to be listed. 🎉 URL:
(comment last updated: 2025-01-31 06:13:46) |
Thanks for suggesting, typically the criteria for inclusion is whether there's current browser support, but there are some exceptions. In the HTTP section, some mechanisms and headers are described that are basically transparent to the browser. For those it's mostly decided case-by-case and whether they're used in other systems / web technologies. For these two headers, they look important for the Open Data (OData) protocol (https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-odata/b4768cbf-13d5-40df-bfa3-7d43ef73e882, https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#_Toc31358871) and PGRest, among others, so I'm +1 on adding these as the footprint is small for the additions 👍🏻 |
2877a20
to
fe67e45
Compare
|
||
{{HTTPSidebar}} | ||
|
||
The HTTP **`Preference-Applied`** header informs the client about which preferences from the `Prefer` request header were applied by the server. |
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.
The HTTP **`Preference-Applied`** header informs the client about which preferences from the `Prefer` request header were applied by the server. | |
The HTTP **`Preference-Applied`** header informs the client about which preferences from the {{httpheader("Prefer"}} request header were applied by the server. |
### Server acknowledges a minimal response preference | ||
|
||
```http | ||
HTTP/1.1 200 OK | ||
Preference-Applied: return=minimal | ||
``` | ||
|
||
### Server acknowledges an asynchronous processing preference | ||
|
||
```http | ||
HTTP/1.1 202 Accepted | ||
Preference-Applied: respond-async | ||
``` |
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.
Can you please update the examples to show the request that caused this response (with appropriate words). You could do the same for prefer
. The whole thing is a little abstract otherwise.
> [!NOTE] | ||
> The `Prefer` header is often used in custom client-server implementations. Ensure both client and server support this header before relying on it in production. | ||
> The `Prefer` header does not cause the server to return an error if it does not support or apply the specified preferences. Instead, the server processes the request as if the header was not present. |
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.
This is good. My concern here is that this has no specific browser integration. That might be worth spelling out (it is implied but not said). Words like "(browsers have no specific handling for these header: they are processed custom client code) or similar
Further, if this is used in a few protocols it might be worth listing a few, such as "Open Data (OData) protocol"
@@ -167,6 +167,13 @@ For more information, refer to the [CORS documentation](/en-US/docs/Web/HTTP/COR | |||
- {{HTTPHeader("Content-Location")}} | |||
- : Indicates an alternate location for the returned data. | |||
|
|||
## Preference | |||
|
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.
Again, might we worth a prefix line custom client-server implementations: they have no specific handling in the browser.
Description
This PR adds two pages for Prefer related headers which are specified in RFC7240 and IETF header registry.
Motivation
I am not sure why they(
Prefer
,Preferrence-Applied
) are not listed on MDN. Is it because the browser has nothing to do with the header? But I seeExpect
also in the MDN header list and I think it is not a browser-oriented header, either.Additional details
Related issues and pull requests
None AFAIK.