pub fn is_media_type(media_type: &str) -> boolExpand description
Whether this is a media type at all: type/subtype, with optional
parameters after a ;.
The question every other one here presumes. A content key with no / in
it names nothing a server can read, so a body sent under it cannot arrive —
which makes it a shape to refuse rather than one to carry.
Only the essence is held to a grammar, and it is RFC 9110’s own: two
non-empty tokens either side of one /. That is deliberately the whole
of the rule. The parameters after the ; are not checked, because a
parameter value may be a quoted string carrying a ; or a /, and a rule
strict enough to judge one would refuse bodies servers accept — the defect
this question exists to catch is a key that was never a media type, not a
parameter spelled unusually. The token rule is the wire’s, not a register
of types this crate knows: application/x-www-form-urlencoded,
application/vnd.api+json and every vendor type anyone coins pass it.