TypeDB.HTTP.Req (TypeDB v0.2.0)

Copy Markdown View Source

TypeDB.HTTP adapter backed by Req and Finch.

Use this when your application already builds requests with Req and you want TypeDB to share that configuration — the same Finch instance, the same connect options, the same TLS setup. It is Finch underneath either way, so it performs like TypeDB.HTTP.Finch; the reason to pick it is configuration, not speed.

:req is an optional dependency of this library — add it yourself:

# mix.exs
{:req, "~> 0.7"}

# then, in the connection's options
http: {TypeDB.HTTP.Req, finch: MyApp.Finch}

All options are forwarded to Req.new/1, so Finch pools, connect options and transport tuning are configured the Req way. The adapter pins three of them: redirects and Req's own retries are off, and the body is left undecoded — TypeDB decides what is safe to retry and owns JSON decoding.

Summary

Types

t()

@type t() :: %TypeDB.HTTP.Req{req: term()}

Functions

request_options(req, method, url, headers, body, opts)

@spec request_options(
  t(),
  TypeDB.HTTP.method(),
  String.t(),
  TypeDB.HTTP.headers(),
  iodata() | nil,
  keyword()
) :: keyword()

The options this adapter hands to Req.request/2.

Public so that the merge below can be asserted on directly: whether a per-request option quietly replaced a configured one is not observable from the outside of a successful request.