(->mime x)(accept x)Given a format keyword or Content-Type-Structured map, returns {"Accept" <mime-type>} or throws if the format is not supported.
Given a format keyword or Content-Type-Structured map, returns {"Accept" <mime-type>} or throws if the format is not supported.
(authorization {:keys [token token-type]})(content-type x)Given a format keyword or Content-Type-Structured map, returns {"Content-Type" <mime-type>} or throws if the format is not supported.
Given a format keyword or Content-Type-Structured map, returns {"Content-Type" <mime-type>} or throws if the format is not supported.
(json-media-type? content-type)Returns true if the given content-type value represents a JSON media type. Accepts either a keyword (e.g. :json, :fhir/json) or a structured map with a :code key.
Returns true if the given content-type value represents a JSON media type. Accepts either a keyword (e.g. :json, :fhir/json) or a structured map with a :code key.
(mime-error x)(parse-mime s)Parses a raw HTTP Content-Type header string into the internal structured map representation of the engine.
Always returns a map with a :code key, and optionally a :properties map if parameters are present in the header or if the media type is unsupported.
The returned map contains:
Examples: (parse-mime "application/json") => {:code :json}
(parse-mime "application/fhir+json; charset=utf-8") => {:code :fhir/json, :properties {"charset" "utf-8"}}
(parse-mime "application/x-custom-type; boundary=123") => {:code :unsupported, :raw-mime "application/x-custom-type" :properties {"boundary" "123"}}
Parses a raw HTTP Content-Type header string into the internal structured
map representation of the engine.
Always returns a map with a :code key, and optionally a :properties map
if parameters are present in the header or if the media type is unsupported.
The returned map contains:
- :code The unassigned format keyword, or :unsupported if not registered.
- :properties An optional map of string key-value pairs representing parameters
(e.g., charset, boundary). If the format is :unsupported, it
includes a :raw-mime key containing the original parsed media type.
Examples:
(parse-mime "application/json")
=> {:code :json}
(parse-mime "application/fhir+json; charset=utf-8")
=> {:code :fhir/json, :properties {"charset" "utf-8"}}
(parse-mime "application/x-custom-type; boundary=123")
=> {:code :unsupported, :raw-mime "application/x-custom-type" :properties {"boundary" "123"}}cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |