Accept
parses Accept headers and performs server-side content
negotiation (RFC 7231 §5.3.2).
negotiate
(Fn [(Ref String a), (Ref (Array String) b)] (Maybe String))
(negotiate accept offers)
selects the best media type to serve from offers given an
Accept header value, per RFC 7231 §5.3.2, as (Maybe String). Each offer's
quality is the weight of the most specific range that matches it; a weight of
0 (or no matching range) makes the offer unacceptable. The highest-quality
acceptable offer wins, ties broken by the order of offers. An empty Accept
accepts anything and yields the first offer; Nothing means nothing is
acceptable.
parse
(Fn [(Ref String a)] (Array MediaRange))
(parse s)
parses an Accept header value into its weighted media ranges, in
header order. Malformed ranges are skipped. Delegates to the MediaType parser,
so wildcards (*/*, type/*) are handled.