ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Server.Accept

Description

Whether a request's Accept header admits a media type a route serves, the one question the router answers 406 Not Acceptable on. Nothing is selected by quality: each route serves one form, so a client that wants another is refused rather than given a substitute.

The reading follows RFC 9110. An absent Accept admits anything, a range matches exactly, by its type half under type/*, or universally under */*, and a range parameter is ignored except q=0, which rejects rather than ranks.

Synopsis

Documentation

acceptsAny :: RequestHeaders -> NonEmpty ByteString -> Bool Source #

Whether the request admits at least one of the media types a route serves. A request with no Accept header admits every one of them.