Back

format-interceptor (clj)

(source)

function

(format-interceptor) (format-interceptor default-muuntaja)
Interceptor for content-negotiation, request and response formatting. Negotiates a request body based on `Content-Type` header and response body based on `Accept`, `Accept-Charset` headers. Publishes the negotiation results as `:muuntaja/request` and `:muuntaja/response` keys into the request. Decodes the request body into `:body-params` using the `:muuntaja/request` key in request if the `:body-params` doesn't already exist. Encodes the response body using the `:muuntaja/response` key in request if the response doesn't have `Content-Type` header already set. Swagger-data will be omitted when `:form`, but no `:body`, parameters are defined. Optionally takes a default muuntaja instance as argument. | key | description | | -------------|-------------| | `:muuntaja` | `muuntaja.core/Muuntaja` instance, does not mount if not set.

Examples