Outbound HTTP as a port, so every adapter above it is testable with a map.
One shape in — {:http/method :http/url :http/headers :http/body} — and one shape out: {:http/status :http/body}, the body already parsed when it was JSON. Only this namespace knows which client library is on the classpath.
Outbound HTTP as a port, so every adapter above it is testable with a map.
One shape in — {:http/method :http/url :http/headers :http/body} — and one
shape out: {:http/status :http/body}, the body already parsed when it was
JSON. Only this namespace knows which client library is on the classpath.(hato-client {:keys [timeout-ms] :or {timeout-ms 10000}})IHttp over hato. :timeout-ms bounds every call; a store must not block on
a ticker or a wallet gateway forever.
IHttp over hato. `:timeout-ms` bounds every call; a store must not block on a ticker or a wallet gateway forever.
(request this req)Perform req. Returns {:http/status :http/body}.
A transport failure is a status of 0 and a nil body: an adapter deciding what an unreachable service means is doing its job, and an exception crossing this port would make every caller do it with try/catch.
Perform `req`. Returns {:http/status :http/body}.
A transport failure is a status of 0 and a nil body: an adapter deciding
what an unreachable service means is doing its job, and an exception
crossing this port would make every caller do it with try/catch.(ok? {:http/keys [status]})True for a 2xx response.
True for a 2xx response.
(parse-json body)body as parsed JSON, or nil when it is not JSON at all.
`body` as parsed JSON, or nil when it is not JSON at all.
(stub-client respond-fn)IHttp from a function of the request. The whole test seam.
respond-fn returns {:http/status :http/body}, or nil for "unreachable".
IHttp from a function of the request. The whole test seam.
`respond-fn` returns {:http/status :http/body}, or nil for "unreachable".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 |