Liking cljdoc? Tell your friends :D

io.axrs.cljs-sync-request.core


clj->jsoncljs

(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.
sourceraw docstring

DELETEcljs

method used to perform a DELETE request

`method` used to perform a `DELETE` request
sourceraw docstring

edncljs

EDN MIME Type

EDN MIME Type
sourceraw docstring

GETcljs

method used to perform a GET request

`method` used to perform a `GET` request
sourceraw docstring

method used to perform a HEAD request

`method` used to perform a `HEAD` request
sourceraw docstring

jsoncljs

JSON MIME Type

JSON MIME Type
sourceraw docstring

json->cljcljs

(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.
sourceraw docstring

mime-transformerscljs

Default mime-transformers for application/edn and application/json requests

Default mime-transformers for application/edn and application/json requests
sourceraw docstring

POSTcljs

method used to perform a POST request

`method` used to perform a `POST` request
sourceraw docstring

PUTcljs

method used to perform a PUT request

`method` used to perform a `PUT` request
sourceraw docstring

wrap-sync-requestcljs

(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"})
 ```
sourceraw docstring

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

× close