Thin, mockable HTTP layer built on hato.
Thin, mockable HTTP layer built on hato.
Dynamic var for the HTTP client. Bind to a mock for tests.
Dynamic var for the HTTP client. Bind to a mock for tests.
(binary-stream-request {:keys [method url headers body] :as req})Make a streaming HTTP request and return the raw java.io.InputStream in :body. Used by adapters that speak a binary framing protocol (e.g. AWS event-stream for Bedrock /converse-stream) and need to decode frames themselves.
Make a streaming HTTP request and return the raw java.io.InputStream in :body. Used by adapters that speak a binary framing protocol (e.g. AWS event-stream for Bedrock /converse-stream) and need to decode frames themselves.
(decode-body body)Parse an HTTP body as JSON when possible. Accepts strings and InputStreams; closes streams it consumes.
Parse an HTTP body as JSON when possible. Accepts strings and InputStreams; closes streams it consumes.
(line-seq-closeable is)Return a lazy seq of lines and close the underlying stream at EOF or on read failure. If callers abandon the lazy seq before EOF, they still own the usual lazy-resource caveat; sdk/complete's :on-event path consumes it fully.
Return a lazy seq of lines and close the underlying stream at EOF or on read failure. If callers abandon the lazy seq before EOF, they still own the usual lazy-resource caveat; sdk/complete's :on-event path consumes it fully.
(request {:keys [method url headers body query-params] :as req})Make an HTTP request. Returns a map with :status, :body, :headers for every status code (including 4xx/5xx) — callers branch on :status. Body is parsed as JSON if Content-Type is application/json.
Make an HTTP request. Returns a map with :status, :body, :headers for every status code (including 4xx/5xx) — callers branch on :status. Body is parsed as JSON if Content-Type is application/json.
(sse-request req)Make an SSE streaming request. Returns a lazy seq of raw SSE line strings. Caller should parse lines with parse-stream-event.
Make an SSE streaming request. Returns a lazy seq of raw SSE line strings. Caller should parse lines with parse-stream-event.
(sse-response {:keys [method url headers body] :as req})Make an SSE streaming request. Returns a response map. Successful responses carry an open InputStream in :body; non-2xx responses carry a parsed body and have already closed the stream.
Make an SSE streaming request. Returns a response map. Successful responses carry an open InputStream in :body; non-2xx responses carry a parsed body and have already closed the stream.
cljdoc 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 |