Liking cljdoc? Tell your friends :D

ring.middleware.format-params


available-charsetsclj

Set of recognised charsets by the current JVM

Set of recognised charsets by the current JVM
sourceraw docstring

decode-msgpackclj

(decode-msgpack body)
source

default-formatsclj

source

default-handle-errorclj

(default-handle-error e _ _)

Default error handling function used, which rethrows the Exception

Default error handling function used, which rethrows the Exception
sourceraw docstring

get-or-guess-charsetclj

(get-or-guess-charset req)

Tries to get the request encoding from the header or guess it if not given in Content-Type. Defaults to utf-8

Tries to get the request encoding from the header or guess
it if not given in *Content-Type*. Defaults to *utf-8*
sourceraw docstring

make-json-decoderclj

(make-json-decoder {:keys [key-fn array-coerce-fn]})
source

make-type-request-predclj

(make-type-request-pred regexp)

Function that returns a predicate fn checking if Content-Type request header matches a specified regexp and body is set.

Function that returns a predicate fn checking if *Content-Type*
request header matches a specified regexp and body is set.
sourceraw docstring

parse-clojure-stringclj

(parse-clojure-string s)

Decode a clojure body. The body is merged into the params, so must be a map or a vector of key value pairs. An empty body is safely handled.

Decode a clojure body. The body is merged into the params, so must be a map
or a vector of key value pairs. An empty body is safely handled.
sourceraw docstring

wrap-clojure-paramsclj

(wrap-clojure-params handler & args)

Handles body params in Clojure (edn) format. See wrap-format-params for details.

Handles body params in Clojure (*edn*) format. See [[wrap-format-params]] for details.
sourceraw docstring

wrap-format-paramsclj

(wrap-format-params handler & args)

Wraps a handler such that requests body are deserialized from to the right format, added in a :body-params key and merged in :params. It takes 4 args:

  • :predicate is a predicate taking the request as sole argument to test if deserialization should be used.
  • :decoder specifies a fn taking the body String as sole argument and giving back a hash-map.
  • :charset can be either a string representing a valid charset or a fn taking the req as argument and returning a valid charset.
  • :binary? if true :charset will be ignored and decoder will receive an InputStream
  • :handle-error is a fn with a sig [exception handler request]. Return (handler obj) to continue executing a modified request or directly a map to answer immediately. Defaults to just rethrowing the Exception
Wraps a handler such that requests body are deserialized from to
  the right format, added in a *:body-params* key and merged in *:params*.
  It takes 4 args:

+ **:predicate** is a predicate taking the request as sole argument to
                 test if deserialization should be used.
+ **:decoder** specifies a fn taking the body String as sole argument and
               giving back a hash-map.
+ **:charset** can be either a string representing a valid charset or a fn
               taking the req as argument and returning a valid charset.
+ **:binary?** if true *:charset* will be ignored and decoder will receive
              an *InputStream*
+ **:handle-error** is a fn with a sig [exception handler request].
                    Return (handler obj) to continue executing a modified
                    request or directly a map to answer immediately. Defaults
                    to just rethrowing the Exception
sourceraw docstring

wrap-json-kw-paramsclj

(wrap-json-kw-params handler & args)

Handles body params in JSON format. Parses map keys as keywords. See wrap-format-params for details.

Handles body params in JSON format. Parses map keys as keywords.
See [[wrap-format-params]] for details.
sourceraw docstring

wrap-json-paramsclj

(wrap-json-params handler & args)

Handles body params in JSON format. See wrap-format-params for details.

Handles body params in JSON format. See [[wrap-format-params]] for details.
sourceraw docstring

wrap-msgpack-kw-paramsclj

(wrap-msgpack-kw-params handler & args)

Handles body params in msgpack format. Parses map keys as keywords. See wrap-format-params for details.

Handles body params in **msgpack** format.  Parses map keys as keywords.
See [[wrap-format-params]] for details.
sourceraw docstring

wrap-msgpack-paramsclj

(wrap-msgpack-params handler & args)

Handles body params in msgpack format. See wrap-format-params for details.

Handles body params in **msgpack** format.
See [[wrap-format-params]] for details.
sourceraw docstring

wrap-restful-paramsclj

(wrap-restful-params handler & args)

Wrapper that tries to do the right thing with the request :body and provide a solid basis for a RESTful API. It will deserialize to JSON, YAML, Transit or Clojure depending on Content-Type header. See wrap-format-params for more details. Options to specific format decoders can be passed in using :format-options option. If should be map of format keyword to options map.

Wrapper that tries to do the right thing with the request :body and provide
a solid basis for a RESTful API. It will deserialize to *JSON*, *YAML*, *Transit*
or *Clojure* depending on Content-Type header. See [[wrap-format-params]] for
more details.
Options to specific format decoders can be passed in using *:format-options*
option. If should be map of format keyword to options map.
sourceraw docstring

wrap-transit-json-paramsclj

(wrap-transit-json-params handler & args)

Handles body params in transit format over JSON. You can use an :options key to pass a map with :handlers and :default-handler to transit-clj. See wrap-format-params for details.

Handles body params in transit format over **JSON**. You can use an *:options* key to pass
a map with *:handlers* and *:default-handler* to transit-clj. See [[wrap-format-params]]
for details.
sourceraw docstring

wrap-transit-msgpack-paramsclj

(wrap-transit-msgpack-params handler & args)

Handles body params in transit format over msgpack. You can use an :options key to pass a map with :handlers and :default-handler to transit-clj. See wrap-format-params for details.

Handles body params in transit format over **msgpack**. You can use an *:options* key to pass
a map with *:handlers* and *:default-handler* to transit-clj. See [[wrap-format-params]] for details.
sourceraw docstring

wrap-yaml-kw-paramsclj

(wrap-yaml-kw-params handler & args)

Handles body params in YAML format. Parses map keys as keywords. See wrap-format-params for details.

Handles body params in YAML format. Parses map keys as keywords.
See [[wrap-format-params]] for details.
sourceraw docstring

wrap-yaml-paramsclj

(wrap-yaml-params handler & args)

Handles body params in YAML format. See wrap-format-params for details.

Handles body params in YAML format. See [[wrap-format-params]] for details.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close