io.pedestal.http.body-params

add-parser

(add-parser parser-map content-type parser-fn)

add-ring-middleware

(add-ring-middleware parser-map content-type middleware)

body-params

(body-params)(body-params parser-map)

custom-edn-parser

(custom-edn-parser & options)

Return an edn-parser fn that, given a request, will read the body of that request with edn/read. options are key-val pairs that will be passed as a hash-map to edn/read.

custom-json-parser

(custom-json-parser & options)

Return a json-parser fn that, given a request, will read the body of that request with json/read. options are key-val pairs that will be passed along to json/read.

custom-transit-parser

(custom-transit-parser & options)

Return a transit-parser fn that, given a request, will read the body of that request with transit/read. options is a sequence to pass to transit/reader along with the body of the request.

default-parser-map

(default-parser-map & parser-options)

Return a map of MIME-type to parsers. Included types are edn, json and form-encoding. parser-options are key-val pairs, valid options are:

:edn-options A hash-map of options to be used when invoking edn/read. :json-options A hash-map of options to be used when invoking json/parse-stream. :transit-options A vector of options to be used when invoking transit/reader - must apply to both json and msgpack

Examples:

(default-parser-map :json-options {:key-fn keyword}) ;; This parser-map would parse the json body ‘{“foo”: “bar”}’ as ;; {:foo “bar”}

(default-parser-map :edn-options {:readers data-readers}) ;; This parser-map will parse edn bodies using any custom edn readers you ;; define (in a data_readers.clj file, for example.)

(default-parser-map :transit-options {:handlers {“custom/model” custom-model-read-handler}}) ;; This parser-map will parse the transit body using a handler defined by ;; custom-model-read-handler.

edn-parser

Take a request and parse its body as edn.

form-parser

(form-parser request)

Take a request and parse its body as a form.

json-parser

Take a request and parse its body as json.

transit-parser

Take a request and parse its body as transit.