Alternera.Plugin.MediaType (alternera_plugin_sdk v0.9.0)

Copy Markdown View Source

What kind of body a Content-Type names: JSON (application/json, text/json, any +json type), XML (application/xml, text/xml, any +xml type) or neither.

Summary

Functions

The plain media type of a kind, the one a body the proxy writes itself carries: application/json, application/xml.

The media type without its parameters, trimmed and in lower case ("Application/JSON; charset=utf-8" → "application/json"); nil for nil.

:json, :xml or nil for a media type (essence/1 first).

Functions

base_type(atom)

@spec base_type(:json | :xml) :: String.t()

The plain media type of a kind, the one a body the proxy writes itself carries: application/json, application/xml.

essence(value)

@spec essence(String.t() | nil) :: String.t() | nil

The media type without its parameters, trimmed and in lower case ("Application/JSON; charset=utf-8" → "application/json"); nil for nil.

kind(value)

@spec kind(String.t() | nil) :: :json | :xml | nil

:json, :xml or nil for a media type (essence/1 first).