Preference-Applied
The Preference-Applied
response header specifies which preferences were observed, if not otherwise evident by the response.
Usage in responses
Writing responses (servers)
Servers write a Preference-Applied
header when they read and act on a preference found in a Prefer header of the request. Servers should write a value for this header for every preference used, since it may be easier for clients to read this header than to inspect the result for the expected outcome.
The server should also emit Vary: Prefer
in the event the response is cachable.
See specific HTTP preference descriptions for more information.
Reading responses (clients)
Clients can read the Preference-Applied
header to verify the server.
Use of the header is optional, and might be omitted if application of the preference is self-evident.
See specific HTTP preference descriptions for more specific advice.
Overview table
- Name
- Preference-Applied
- Description
- Specifies which preferences were observed, if not otherwise evident by the response.
- Direction
- Response
- Specification
- RFC 7240: Prefer Header for HTTP
Syntax
Preference-Applied = "Preference-Applied" ":" 1#applied-pref
applied-pref = preference-parameter
preference-parameter = parameter / token
Example
HTTP/1.1 200 OK
Content-Type: application/json
Preference-Applied: return=representation
Content-Location: /my-document
{"a": 1}
Implementations
The Preference-Applied
is a syntatic subset of the Prefer header, consider using a library for parsing that header, and looking for tokens with no parameters.