MediaType
is a parsed media type — the value of a Content-Type header,
such as multipart/form-data; boundary=abc. type and subtype are
lower-cased; params maps lower-cased parameter names to their values with any
surrounding quotes removed.
mime
(Fn [(Ref MediaType a)] String)
(mime mt)
returns the type/subtype string, without any parameters.
param
(Fn [(Ref MediaType a), (Ref String b)] (Maybe String))
(param mt name)
looks up a parameter by name (case-insensitive), returning
(Maybe String).
params
(Fn [(Ref MediaType a)] (Ref (Map String String) a))
gets the params property of a MediaType.
parse
(Fn [(Ref String a)] (Result MediaType String))
(parse s)
parses a Content-Type header value into a MediaType. Fails
when there is no type/subtype.
parse-params
(Fn [(Ref String a)] (Map String String))
(parse-params s)
parses an RFC 2045 parameter list — the ; k=v; k2="quoted"
tail shared by Content-Type and Content-Disposition — into a map from
lower-cased parameter names to unquoted values. Any leading segment without an
= (the media type or disposition itself) is ignored, so the whole header
value may be passed.
set-params
(Fn [MediaType, (Map String String)] MediaType)
sets the params property of a MediaType.
set-params!
(Fn [(Ref MediaType a), (Map String String)] ())
sets the params property of a MediaType in place.
set-subtype
(Fn [MediaType, String] MediaType)
sets the subtype property of a MediaType.
set-subtype!
(Fn [(Ref MediaType a), String] ())
sets the subtype property of a MediaType in place.
set-type!
(Fn [(Ref MediaType a), String] ())
sets the type property of a MediaType in place.
subtype
(Fn [(Ref MediaType a)] (Ref String a))
gets the subtype property of a MediaType.
update-params
(Fn [MediaType, (Ref (Fn [(Map String String)] (Map String String) a) b)] MediaType)
updates the params property of a MediaType using a function f.
update-subtype
(Fn [MediaType, (Ref (Fn [String] String a) b)] MediaType)
updates the subtype property of a MediaType using a function f.
update-type
(Fn [MediaType, (Ref (Fn [String] String a) b)] MediaType)
updates the type property of a MediaType using a function f.