io.pedestal.service.interceptors
added in 0.8.0
html-body
Sets the Content-Type header to “text/html” if the body is a string and a type has not been set.
json-body
Set the Content-Type header to “application/json” and convert the body to JSON if the body is a collection and a type has not been set.
not-found
An interceptor that returns a 404 when routing failed to resolve a route, or no :response map was attached to the context.
transit-body-interceptor
(transit-body-interceptor iname default-content-type transit-format)
(transit-body-interceptor iname default-content-type transit-format transit-opts)
Returns an interceptor which sets the Content-Type header to the appropriate value depending on the transit format. Converts the body to the specified Transit format if the body is a collection and a type has not been set. Optionally accepts transit-opts which are handed to trasit/writer and may contain custom write handlers.
Expects the following arguments:
iname - namespaced keyword for the interceptor name default-content-type - content-type string to set in the response transit-format - either :json or :msgpack transit-options - optional. map of options for transit/writer
transit-json-body
Set the Content-Type header to “application/transit+json” and convert the body to transit+json if the body is a collection and a type has not been set.
transit-msgpack-body
Set the Content-Type header to “application/transit+msgpack” and convert the body to transit+msgpack if the body is a collection and a type has not been set.