Net.HTTP.MediaType
A media type (RFC 9110 §8.3.1): text/html; charset=utf-8, what a
Content-Type says a body is, and what an Accept asks for.
The type, the subtype and parameter names are case-insensitive, and are
stored lowercase. Parameter values keep their case, since some are
case-sensitive, and are held unquoted: parameter(m, "charset") of
text/plain; charset="utf-8" is utf-8. toString quotes a value only
where a token cannot spell it.
Media ranges, as Accept writes them, are media types too: * is a
token, so */* and text/* parse, and q is a parameter like any other.
*/*, the range that matches every media type.
media-type = type "/" subtype parameters
Returns the media type text writes, and panics if it writes none.
Reads a media type at the cursor, and leaves the cursor after it. This is
for the fields that hold a media type among other things; parse reads
one that is all of its text.
parameters = *( OWS ";" OWS [ parameter ] ) parameter = name "=" ( token / quoted-string )
A parameter named twice is refused: which one counts is not defined, and two readers that choose differently disagree about the body.
Returns the type and subtype without parameters: text/html.
Returns the value of the parameter name, which is case-insensitive.
Returns m with the parameter name set to value, replacing one of that
name. Returns None if name is not a token, or value holds a byte a
quoted string cannot carry.
Whether the media range range matches m (RFC 9110 §12.5.1): */*
matches everything, text/* every text type, and otherwise the essences
must be equal. Each of the range's parameters other than q must be one
m has.
Two media types are equal when their types, subtypes and parameters are, the parameters in order.