Dowser.Client.HTTP.Req (Dowser.Client v0.1.1)

View Source

HTTP adapter backed by the Req library.

Req is an optional dependency. Add {:req, "~> 0.5"} to your deps to use this adapter; a helpful error is raised at call time if it is missing.

Response body decoding is disabled (decode_body: false) so Dowser receives the raw payload and handles JSON/NDJSON itself.

The transport is pinned to HTTP/1.1 via connect_options: [protocols: [:http1]] (otherwise Mint would negotiate HTTP/2 over ALPN on TLS). Finch pools the connection, giving keep-alive. This is enforced after merging caller opts, so :protocols cannot be accidentally overridden.

receive_timeout defaults to 30_000 and connect_options[:timeout] to 2_000 (milliseconds); either can be overridden by the caller. Finch's own :pool_timeout (time spent waiting to check out a pooled connection) already defaults to 5_000, so it is left untouched here — setting it explicitly would require the :finch option, which Req refuses to combine with the :connect_options this adapter relies on for the HTTP/1.1 pin.

Req's own built-in retry (retry: :safe_transient by default) is disabled by default, since retry is handled once, generically, by Dowser.Client.Retry regardless of adapter — leaving Req's retry on too would silently multiply the number of attempts. Pass retry: :safe_transient (or any other Req retry option) through opts to opt back into it.

Options

All opts are merged into the Req.request/1 options and win over the defaults set here, so any Req option (e.g. retry, receive_timeout) can be passed through. Extra :connect_options are honored and merged with the enforced :protocols.