(default-val-transform _ v)
Default transformation that is used on params' values
Default transformation that is used on params' values
(defrest definition & {:keys [edn-readers edn-key] :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 also use classpath:
or file:
protocol.
Definition can be followed by opts key-value arguments, all of them are optional.
:post-process-fn
This option specifies a function that is invoked after generating clj-http in API function. Defaults to identity.
:default-method
sets the default method for endpoints with no method specified, defaults to :get
:param-transform
This option specifies function that is used to transform query/form/key param kw/symbol to final name. 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 and param value, returns new param value.
Defaults to a function that converts keyword values to a string.
: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.
:json-opts
map of opts passed to Cheshire generate-string when used by this library
:defaults
map of default clj-http params added to every call, defaults to {}
:edn-readers
map of reader to supply to edn reading process when invoking with a string argument
:edn-key
when loading EDN use a specific key in loaded EDN, useful when using refs
:fdef?
emit a fdef for generated functions, defaults to false
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 also use `classpath:` or `file:` protocol. Definition can be followed by opts key-value arguments, all of them are optional. `:post-process-fn` This option specifies a function that is invoked after generating clj-http in API function. Defaults to identity. `:default-method` sets the default method for endpoints with no method specified, defaults to `:get` `:param-transform` This option specifies function that is used to transform query/form/key param kw/symbol to final name. 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 and param value, returns new param value. Defaults to a function that converts keyword values to a string. `: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. `:json-opts` map of opts passed to Cheshire generate-string when used by this library `:defaults` map of default clj-http params added to every call, defaults to {} `:edn-readers` map of reader to supply to edn reading process when invoking with a string argument `:edn-key` when loading EDN use a specific key in loaded EDN, useful when using refs `:fdef?` emit a fdef for generated functions, defaults to false
(defrest* definition
&
{:keys [json-responses fdef? jsonify-bodies param-transform
val-transform post-process-fn defaults json-opts
default-method]
:or {json-responses true
jsonify-bodies :smart
post-process-fn identity
defaults {}
default-method :get}})
(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