Like ring.middleware.json
but faster because uses
internal JSON engine instead of Cheshire.
Like `ring.middleware.json` but faster because uses internal JSON engine instead of Cheshire.
(json-request? request)
True if it was a request with JSON payload.
True if it was a request with JSON payload.
(wrap-json handler)
(wrap-json handler options)
Two in one: wrap a handler with wrap-json-request and wrap-json-response. All the optional parameters are supported.
Two in one: wrap a handler with wrap-json-request and wrap-json-response. All the optional parameters are supported.
(wrap-json-request handler)
(wrap-json-request handler
{:keys [slot malformed-response]
:or {slot :json malformed-response RESP-JSON-MALFORMED}})
If it was a JSON request, parse the body and assoc the data into a dedicated field. We do not overwrite the :body field because it's still might be needed to calculate a checksum, for example.
Suports the following options:
If it was a JSON request, parse the body and assoc the data into a dedicated field. We *do not* overwrite the :body field because it's still might be needed to calculate a checksum, for example. Suports the following options: - :slot -- the field where the parsed JSON data gets associated; - :malformed-response -- a response map which gets returned when we could not parse the payload. Default is 400 with a plain text error message.
(wrap-json-response handler)
(wrap-json-response handler _)
If the :body of the response is a collection, JSON-encode it and add a corresponding HTTP header.
If the :body of the response is a collection, JSON-encode it and add a corresponding HTTP header.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close