Liking cljdoc? Tell your friends :D

zeph.client

Cross-platform HTTP client using Java NIO. API compatible with http-kit client.

Cross-platform HTTP client using Java NIO.
API compatible with http-kit client.
raw docstring

*force-http1*clj

source

*trace*clj

source

*trace-detail*clj

source

close-clientclj

(close-client client)

Close an HTTP client.

Close an HTTP client.
sourceraw docstring

create-clientclj

(create-client)
(create-client opts)

Create a new HTTP client with custom options.

Options: :backend - Backend to use (:auto, :io-uring, :nio) :auto selects io_uring on Linux, NIO on Windows/macOS :workers - Number of worker threads (default: CPU/2) :ring-size - io_uring ring size (default: 256, io_uring only) :max-connections-per-host - Max connections per host (default: 20) :max-total-connections - Max total connections (default: 200) :idle-timeout - Idle connection timeout in ms (default: 60000) :connection-timeout - Connection timeout in ms (default: 30000)

Returns: HttpClientNio instance (call .close when done)

Create a new HTTP client with custom options.

Options:
  :backend                - Backend to use (:auto, :io-uring, :nio)
                            :auto selects io_uring on Linux, NIO on Windows/macOS
  :workers                - Number of worker threads (default: CPU/2)
  :ring-size              - io_uring ring size (default: 256, io_uring only)
  :max-connections-per-host - Max connections per host (default: 20)
  :max-total-connections  - Max total connections (default: 200)
  :idle-timeout           - Idle connection timeout in ms (default: 60000)
  :connection-timeout     - Connection timeout in ms (default: 30000)

Returns: HttpClientNio instance (call .close when done)
sourceraw docstring

deleteclj

(delete url)
(delete url opts-or-callback)
(delete url opts callback)

Send a DELETE request. Returns promise (http-kit compatible).

Send a DELETE request. Returns promise (http-kit compatible).
sourceraw docstring

executeclj

(execute req)
(execute req opts)

Execute a raw HttpClientRequest object.

Usage: @(execute req) @(execute req {:timeout 30000})

The request object can be created via Java interop: (-> (HttpClientRequest/post "https://example.com/") (.multipart "field" "value") (.multipartFile "file" (io/file "path") "application/octet-stream"))

Execute a raw HttpClientRequest object.

Usage:
  @(execute req)
  @(execute req {:timeout 30000})

The request object can be created via Java interop:
  (-> (HttpClientRequest/post "https://example.com/")
      (.multipart "field" "value")
      (.multipartFile "file" (io/file "path") "application/octet-stream"))
sourceraw docstring

getclj

(get url)
(get url opts-or-callback)
(get url opts callback)

Send a GET request. Returns promise (http-kit compatible).

Usage: @(get "https://example.com") @(get "https://example.com" {:timeout 5000}) (get "https://example.com" {:timeout 5000} callback)

Send a GET request. Returns promise (http-kit compatible).

Usage:
  @(get "https://example.com")
  @(get "https://example.com" {:timeout 5000})
  (get "https://example.com" {:timeout 5000} callback)
sourceraw docstring

(head url)
(head url opts-or-callback)
(head url opts callback)

Send a HEAD request. Returns promise (http-kit compatible).

Send a HEAD request. Returns promise (http-kit compatible).
sourceraw docstring

patchclj

(patch url)
(patch url opts-or-callback)
(patch url opts callback)

Send a PATCH request. Returns promise (http-kit compatible).

Send a PATCH request. Returns promise (http-kit compatible).
sourceraw docstring

pool-statsclj

(pool-stats)

Get connection pool statistics for the default client.

Get connection pool statistics for the default client.
sourceraw docstring

postclj

(post url)
(post url opts-or-callback)
(post url opts callback)

Send a POST request. Returns promise (http-kit compatible).

Usage: @(post "https://example.com" {:body "data"}) (post "https://example.com" {:body "data"} callback)

Send a POST request. Returns promise (http-kit compatible).

Usage:
  @(post "https://example.com" {:body "data"})
  (post "https://example.com" {:body "data"} callback)
sourceraw docstring

putclj

(put url)
(put url opts-or-callback)
(put url opts callback)

Send a PUT request. Returns promise (http-kit compatible).

Send a PUT request. Returns promise (http-kit compatible).
sourceraw docstring

requestclj

(request opts)
(request opts callback)

Send an HTTP request.

Options: :url - Request URL (required) :method - HTTP method (:get, :post, :put, :delete, :head) :headers - Request headers map :body - Request body (string or bytes) :query-params - Query parameters map :form-params - Form parameters map (sets Content-Type) :multipart - Multipart form data as vector of maps: [{:name "field" :content "value"} {:name "file" :content (io/file "path") :filename "name.txt"}] Each map supports :name, :content, :filename, :content-type :timeout - Request timeout in ms (default: 30000) :keepalive - Keep-alive time in ms (default: 120000, -1 to disable) :follow-redirects - Follow redirects (default: true) :max-redirects - Maximum redirects to follow (default: 5) :insecure? - Skip SSL certificate validation (default: false) :basic-auth - Basic auth as [user password] :trace - Print request/response flow to stderr (default: false) :trace-detail - Print headers and body details to stderr (default: false) :as - Response body coercion (:text, :stream, :byte-array)

Returns a promise that can be:

  • Dereferenced with @ for synchronous access
  • Used with deref with timeout
  • Called as a function with callback

Examples: ;; Synchronous @(request {:url "https://example.com" :method :get})

;; With timeout (deref (request {:url "https://example.com"}) 5000 :timeout)

;; With callback (request {:url "https://example.com"} (fn [{:keys [status body error]}] (println status body)))

;; With trace @(request {:url "https://example.com" :trace true})

;; With detailed trace @(request {:url "https://example.com" :trace-detail true})

Send an HTTP request.

Options:
  :url              - Request URL (required)
  :method           - HTTP method (:get, :post, :put, :delete, :head)
  :headers          - Request headers map
  :body             - Request body (string or bytes)
  :query-params     - Query parameters map
  :form-params      - Form parameters map (sets Content-Type)
  :multipart        - Multipart form data as vector of maps:
                      [{:name "field" :content "value"}
                       {:name "file" :content (io/file "path") :filename "name.txt"}]
                      Each map supports :name, :content, :filename, :content-type
  :timeout          - Request timeout in ms (default: 30000)
  :keepalive        - Keep-alive time in ms (default: 120000, -1 to disable)
  :follow-redirects - Follow redirects (default: true)
  :max-redirects    - Maximum redirects to follow (default: 5)
  :insecure?        - Skip SSL certificate validation (default: false)
  :basic-auth       - Basic auth as [user password]
  :trace            - Print request/response flow to stderr (default: false)
  :trace-detail     - Print headers and body details to stderr (default: false)
  :as               - Response body coercion (:text, :stream, :byte-array)

Returns a promise that can be:
  - Dereferenced with @ for synchronous access
  - Used with deref with timeout
  - Called as a function with callback

Examples:
  ;; Synchronous
  @(request {:url "https://example.com" :method :get})

  ;; With timeout
  (deref (request {:url "https://example.com"}) 5000 :timeout)

  ;; With callback
  (request {:url "https://example.com"}
           (fn [{:keys [status body error]}]
             (println status body)))

  ;; With trace
  @(request {:url "https://example.com" :trace true})

  ;; With detailed trace
  @(request {:url "https://example.com" :trace-detail true})
sourceraw 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