(clj->json e)
A no assumption clj->JSON encoding function used by all json-*
request methods with a :body
. Can be replaced by
specifying :encode
in the opts
of any request method.
A no assumption clj->JSON encoding function used by all `json-*` request methods with a `:body`. Can be replaced by specifying `:encode` in the `opts` of any request method.
method
used to perform a DELETE
request
`method` used to perform a `DELETE` request
method
used to perform a GET
request
`method` used to perform a `GET` request
method
used to perform a HEAD
request
`method` used to perform a `HEAD` request
(json->clj s)
A no assumption JSON->clj decoding function used by all json-*
request methods decode a response :body
. Can be
replaced by specifying the :decode
in the opts
of any request method.
A no assumption JSON->clj decoding function used by all `json-*` request methods decode a response `:body`. Can be replaced by specifying the `:decode` in the `opts` of any request method.
Default mime-transformers for application/edn and application/json requests
Default mime-transformers for application/edn and application/json requests
method
used to perform a POST
request
`method` used to perform a `POST` request
method
used to perform a PUT
request
`method` used to perform a `PUT` request
(wrap-sync-request sync-request & [transformers])
Wraps sync-request
, returning a single arity function to perform http requests.
Transformers are provided to encode request bodies and response bodies.
JSON is encoding by io.axrs.cljs-sync-request.core/clj->json
, and decoded by io.axrs.cljs-sync-request.core/clj->json
.
EDN is encoding by pr-str
, and decoded by clojure.reader/read-string
.
Refer to sync-request options for all available features of the
request map including :timeout
, :retry
, :maxRetries
, :qs
, and more.
(def transformers {"application/json" {:decode #(js->clj (js/JSON.parse %)) :encode #(js/JSON.stringify (clj->js %))}})
(def request (wrap-sync-request sync-request transformers))
(request {:body {:id "123"} :content-type "application/json" :method "POST"})
Wraps `sync-request`, returning a single arity function to perform http requests. Transformers are provided to encode request bodies and response bodies. JSON is encoding by `io.axrs.cljs-sync-request.core/clj->json`, and decoded by `io.axrs.cljs-sync-request.core/clj->json`. EDN is encoding by `pr-str`, and decoded by `clojure.reader/read-string`. Refer to [sync-request options](https://github.com/ForbesLindesay/sync-request/) for all available features of the request map including `:timeout`, `:retry`, `:maxRetries`, `:qs`, and more. ``` (def transformers {"application/json" {:decode #(js->clj (js/JSON.parse %)) :encode #(js/JSON.stringify (clj->js %))}}) (def request (wrap-sync-request sync-request transformers)) (request {:body {:id "123"} :content-type "application/json" :method "POST"}) ```
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close