An HTTP client implementation of the :gun library. Requires :gun to be added
as a dependency.
Speaks HTTP/1.1 and HTTP/2 over TCP, TLS (Transport Layer Security) and unix
domain sockets. The driver sets no protocols option, so :gun's own
defaults apply: HTTP/1.1 on cleartext, and on TLS an ALPN
(Application-Layer Protocol Negotiation) offer of both protocols with
HTTP/2 preferred. client_opts: %{protocols: [:http2]} asserts HTTP/2 on
cleartext by prior knowledge, or pins TLS to it.
The request-body size bound documented on Arangox.MintClient does not
apply here: :gun queues a request body and honours WINDOW_UPDATE
itself, so this client carries a body of any size under HTTP/2.
The merged header list is delivered to :gun as given — order kept,
duplicates kept, names as written. Response headers come back as the
parsed list on Arangox.Response — names lowercased, order and repeats
as received.
The per-request socket write bounds documented on Arangox.MintClient
deliberately do not apply here: :gun writes from its own process, so a
caller can never block inside a socket send, and every caller wait is
bounded by the request deadline. The socket still carries the same
teardown hygiene as the other clients — a bounded driver queue and an
abort on close — protecting :gun's process rather than the caller.
Arangox.MintClient is the default and the one the documentation assumes.
This client is supported for applications already using it.
Conforms to the Arangox.Client error contract: every failure is an
Arangox.Error carrying a :reason atom, and neither connect/2 nor
request/3 raises or exits.
Options
:client_opts is a map, merged over the options below. Gun takes its
transport options under :tcp_opts and :tls_opts; :ssl_opts given to
Arangox.start_link/1 reaches the latter.