(client)(client {:keys [headers timeout-ms throw? as connect-timeout-ms
follow-redirects]
:as _opts})Creates a reusable client with optional default request options.
Supported keys:
Creates a reusable client with optional default request options. Supported keys: - :headers map - :timeout-ms positive int - :throw? boolean - :as one of :string, :bytes, :none, :json, :stream - (CLJ only) :connect-timeout-ms positive int - (CLJ only) :follow-redirects one of :always, :normal, :never
(delete url)(delete a b)(delete client url opts)(get url)(get a b)(get client url opts)(post url)(post a b)(post client url opts)(put url)(put a b)(put client url opts)(request req)(request {:keys [http-client defaults] :as _client}
{:keys [json-key-fn] :as req})Performs an HTTP request.
Options:
Performs an HTTP request. Options: - :method keyword, default :get - :url string (required) - :headers map - :query-params map (values may be sequential) - :body nil|string|bytes - :timeout-ms positive int (applies to request + body) - :as one of :string, :bytes, :none, :json, :stream (default :string) - :json clj value to encode as JSON request body (mutually exclusive with :body) - :form-params map to encode as x-www-form-urlencoded (mutually exclusive with :body) - :multipart sequential parts to encode as multipart/form-data (mutually exclusive with :body) - :throw? boolean (default true)
(request req)(request {:keys [defaults] :as _client} {:keys [] :as req})CLJS implementation backed by fetch. Returns a js/Promise that resolves to {:status :headers :body :url}.
CLJS implementation backed by fetch. Returns a js/Promise that resolves to {:status :headers :body :url}.
(request-async req)(request-async {:keys [http-client defaults] :as _client}
{:keys [json-key-fn] :as req})Async request. Returns a core.async channel that yields exactly one value:
Async request. Returns a core.async channel that yields exactly one value:
- {:ok resp-map} on success
- {:error ex} on failure (network error or HTTP status>=400 when :throw? true)(request-async req)(request-async client req)CLJS async request wrapper. Returns a core.async channel that yields exactly one value:
CLJS async request wrapper. Returns a core.async channel that yields exactly one value:
- {:ok resp-map} on success
- {:error ex} on failurecljdoc 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 |