Module content_negotiation

Source
Expand description

The content_negotiation module deals with handling media types, languages, charsets and encodings as per https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html.

Structs§

Charset
Struct to represent a character set
Encoding
Struct to represent an encoding
MediaLanguage
Struct to represent a media language
MediaType
Struct to represent a media type

Enums§

MediaTypeMatch
Enum to represent a match with media types

Functions§

acceptable_content_type
Determines if the media type accepted by the resource matches the media type provided by the client. Returns the match if there is one.
matching_charset
Determines if the charsets produced by the resource matches the acceptable charsets provided by the client. Returns the match if there is one.
matching_content_type
Determines if the media types produced by the resource matches the acceptable media types provided by the client. Returns the match if there is one.
matching_encoding
Determines if the encodings supported by the resource matches the acceptable encodings provided by the client. Returns the match if there is one.
matching_language
Determines if the languages produced by the resource matches the acceptable languages provided by the client. Returns the match if there is one.
sort_encodings
Sorts the list of encodings by weighting as per https://tools.ietf.org/html/rfc2616#section-14.3. Note that identity encoding is awlays added with a weight of 1 if not already present.
sort_media_charsets
Sorts the list of charsets by weighting as per https://tools.ietf.org/html/rfc2616#section-14.2. Note that ISO-8859-1 is added as a default with a weighting of 1 if not all ready supplied.
sort_media_languages
Sorts the list of media types by weighting
sort_media_types
Sorts the list of media types by their weights