(default-val-transform _ v)
Default transformation that is used on params' values
Default transformation that is used on params' values
(defrest definition & {:keys [] :as args})
Defines multiple functions based on definition map. For map's structure see docs.
Valid definition parameters any of the following: map literal, a symbol (naming a var that resolves to a map), a string URL.
URL string can use classpath:
or file:
protocol.
Definition can be followed by opts key-value arguments, all of them are optional.
:param-transform
This option specifies function that is transformation: parameter name (symbol) -> query parameter name (string). Default identity
.
:val-transform
A function that is used to transform all parameter values before they put in map. Fn signature should be (param-name-symbol, param-value) -> new param value.
Defaults to a function that converts keywords to a string name (no ns).
:json-bodies
If true then body parameters are sent as to-JSON serialized form params, otherwise body params are simply added to request as :body
. Default true.
:json-responses
If true then all requests specify {:as :json}
and all responses are expected to be json responses. Default true.
:instrument
Every function defined by defrest
has its own fdef
args spec. If instrument option is true, then all generated functions are also instrumented. Default true.
Defines multiple functions based on definition map. For map's structure see docs. Valid definition parameters any of the following: map literal, a symbol (naming a var that resolves to a map), a string URL. URL string can use `classpath:` or `file:` protocol. Definition can be followed by opts key-value arguments, all of them are optional. `:param-transform` This option specifies function that is transformation: parameter name (symbol) -> query parameter name (string). Default `identity`. `:val-transform` A function that is used to transform all parameter values before they put in map. Fn signature should be (param-name-symbol, param-value) -> new param value. Defaults to a function that converts keywords to a string name (no ns). `:json-bodies` If true then body parameters are sent as to-JSON serialized form params, otherwise body params are simply added to request as `:body`. Default true. `:json-responses` If true then all requests specify `{:as :json}` and all responses are expected to be json responses. Default true. `:instrument` Every function defined by `defrest` has its own `fdef` args spec. If instrument option is true, then all generated functions are also instrumented. Default true.
(defrest-map definition
{:keys [json-responses json-bodies param-transform instrument
val-transform]
:or {json-responses true json-bodies true instrument true}})
(merge-maps & values)
(parse-vars uri)
Parse URI into alternating fixed strings and vars.
Parse URI into alternating fixed strings and vars.
(prefix-middleware url-prefix)
Function for creating a clj-http middleware that prepends to url.
Function for creating a clj-http middleware that prepends to url.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close