Spindle_http.Media_typeA media type, as Content-Type holds one (RFC 9110 §8.3.1): a type, a subtype and parameters.
Media_type.parse {|application/json; charset="utf-8"|}
= Ok
{
type_ = "application";
subtype = "json";
parameters = [ ("charset", "utf-8") ];
}val parse : string -> (t, string) Stdlib.resultA field's value as one media type, and nothing after it; a parameter given twice is an Error (RFC 6838 §4.3), in words for a log.
val to_string : t -> (string, string) Stdlib.resulttype/subtype, then each parameter as ; name=value, its value a quoted string where it is not a token, or Error for what parse would not read back as itself: a type or a name that is no token or is not lower-cased, a parameter twice, a value no quoted string can hold.
Whether a text is one matches reads: type/subtype, type/* or type/*+suffix, each a token, and no parameters.
val matches : string -> t -> boolmatches pattern t: whether t is of pattern -- type/subtype, type/* or type/*+suffix, application/*+json for application/ld+json -- compared without case, its parameters not compared. A pattern of none of these forms matches nothing.
val parameter : t -> string -> string optionThe first value of the parameter named, whatever the name's case.