HTTP adapter contract for outbound delivery.
request/5 returns {:ok, %{status: status, headers: headers, body: body}}
or {:error, reason}. Issue one request and return redirects to the delivery
runtime for classification. The default adapter is AshHooks.Http.Bounded;
AshHooks.Http.Httpc provides an alternative built on OTP's HTTP client.
Writing an adapter
- Return response headers as a list of
{name, value}tuples with binary names and values. Normalize names to lowercase; conventionalRetry-AfterandContent-Typenames are also recognized. This shape preservesRetry-Afterand content-type handling; a map causes the runtime to use ordinary backoff and theothercontent kind. - Resolve-and-pin: resolve through
AshHooks.Ssrf.resolve_public/1and connect to an address from that validated result. Preserve the original hostname for TLS certificate verification and SNI, and the original authority for the Host header. Resolving again during connection allows DNS rebinding between validation and use. Both supplied adapters pin their connection address. - Bound the complete operation and response memory. Bounded defaults to
15 seconds for the operation, 32 KiB for headers, and 64 KiB for the body.
See
AshHooks.Http.Httpcfor its response-buffering limitations.
Summary
Callbacks
Sends the prepared method, target, ordered header lines and body unchanged.
Write method target HTTP/1.1, then exactly the supplied lines in order,
then the body. Add, remove, duplicate or reorder nothing. Custom adapters
and transports own this trusted boundary, including any downstream hop.
Callbacks
@callback send_prepared(AshHooks.Http.Request.t(), keyword()) :: {:ok, %{status: integer(), headers: list(), body: binary() | nil}} | {:error, term()}
Sends the prepared method, target, ordered header lines and body unchanged.
Write method target HTTP/1.1, then exactly the supplied lines in order,
then the body. Add, remove, duplicate or reorder nothing. Custom adapters
and transports own this trusted boundary, including any downstream hop.