(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.
:client This option specifies function that is invoked with clj-http maps generated by api functions. Defaults to identity.
This is a good place to put your http client function if you want requests to be executed immediately.
:param-transform This option specifies function that is uset to transform query parameter names: parameter name (symbol) -> query parameter name (string). Default identity.
:val-transform This option specifies a function that is applied to all arguments after argument spec and conform and before being embedded into
request map. It's a function of two arguments: param name symbol and param value, returns new param value.
Defaults to a function that converts keywords to a string name (no ns).
:jsonify-bodies set to :always, :smart, :never. Body params will be ran through serializer if set to :always. Option :smart will not
run string or bytes bodies through JSON serializer. Defaults to :smart.
:json-responses If true then all requests specify {:as :json} and all responses are expected to be json responses. Default true.
:defaults map of default clj-http params added to every call, defaults to {}
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.
`:client` This option specifies function that is invoked with clj-http maps generated by api functions. Defaults to identity.
This is a good place to put your http client function if you want requests to be executed immediately.
`:param-transform` This option specifies function that is uset to transform query parameter names: parameter name (symbol) -> query parameter name (string). Default `identity`.
`:val-transform` This option specifies a function that is applied to all arguments after argument spec and conform and before being embedded into
request map. It's a function of two arguments: param name symbol and param value, returns new param value.
Defaults to a function that converts keywords to a string name (no ns).
`:jsonify-bodies` set to `:always`, `:smart`, `:never`. Body params will be ran through serializer if set to `:always`. Option `:smart` will not
run string or bytes bodies through JSON serializer. Defaults to :smart.
`:json-responses` If true then all requests specify `{:as :json}` and all responses are expected to be json responses. Default true.
`:defaults` map of default clj-http params added to every call, defaults to {}
(defrest-map
definition
{:keys [json-responses jsonify-bodies param-transform val-transform client
defaults]
:or {json-responses true jsonify-bodies :smart client identity defaults {}}})(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 builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |