Proactive content negotiation by RFC 9110, section 12: the media type and the language of a response, picked from the offers of a server by the Accept and Accept-Language fields of a request.
The functions that pick take a field value and the offers in the server's order of preference. A nil field value means that the client has no preference, so the first offer wins. They return an offer as given, or nil when none is acceptable. With a function that returns the media type or language tag of an item, they pick items instead.
The negotiate function decides for a whole Ring request, with overrides from query parameters and cookies, and returns the fields for Vary. The functions after it make the headers and responses that follow.
Proactive content negotiation by RFC 9110, section 12: the media type and the language of a response, picked from the offers of a server by the Accept and Accept-Language fields of a request. The functions that pick take a field value and the offers in the server's order of preference. A nil field value means that the client has no preference, so the first offer wins. They return an offer as given, or nil when none is acceptable. With a function that returns the media type or language tag of an item, they pick items instead. The negotiate function decides for a whole Ring request, with overrides from query parameters and cookies, and returns the fields for Vary. The functions after it make the headers and responses that follow.
A Pedestal interceptor that negotiates each request.
The interceptor is a map, so the library doesn't depend on Pedestal. A route takes it as it is. Elsewhere, e.g. among the interceptors of a service, pass it to io.pedestal.interceptor/interceptor first.
A Pedestal interceptor that negotiates each request. The interceptor is a map, so the library doesn't depend on Pedestal. A route takes it as it is. Elsewhere, e.g. among the interceptors of a service, pass it to io.pedestal.interceptor/interceptor first.
Ring middleware that negotiates each request before the handler gets it.
Ring middleware that negotiates each request before the handler gets it.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |