Liking cljdoc? Tell your friends :D

httpcljent.http


clientclj/s

(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:

  • :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
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
raw docstring

deleteclj/s

(delete url)
(delete a b)
(delete client url opts)

getclj/s

(get url)
(get a b)
(get client url opts)

postclj/s

(post url)
(post a b)
(post client url opts)

putclj/s

(put url)
(put a b)
(put client url opts)

requestclj/s≠

clj
(request req)
(request {:keys [http-client defaults] :as _client}
         {:keys [json-key-fn] :as req})

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)
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)
cljs
(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}.
raw docstring

request-asyncclj/s≠

clj
(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:

  • {:ok resp-map} on success
  • {:error ex} on failure (network error or HTTP status>=400 when :throw? true)
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)
cljs
(request-async req)
(request-async client req)

CLJS async request wrapper. Returns a core.async channel that yields exactly one value:

  • {:ok resp-map} on success
  • {:error ex} on failure
CLJS async request wrapper. Returns a core.async channel that yields exactly one value:
- {:ok resp-map} on success
- {:error ex} on failure
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close