# `HTTP.Adapter`
[🔗](https://github.com/gsmlg-dev/http_fetch/blob/v1.0.0-rc.9/apps/http_fetch/lib/http/adapter.ex#L1)

A two-stage request adapter for `HTTP.fetch/2`.

Pass `adapter: {Module, configuration}` (or `adapter: Module`). `prepare/2`
runs in the caller after Fetch input normalization and must return immutable
context. `execute/3` runs in the request's existing Promise worker. Adapters
return an `HTTP.Response` or `{:error, reason}`; Fetch applies telemetry and
the requested error mode. Adapter errors never fall back to socket transport.

Adapters own the resources they create and must register applicable streams
with `HTTP.RequestLifecycle.current/0`. Simulated cleanup proves only those
resources, not network or pool behavior.

# `execute`

```elixir
@callback execute(HTTP.Request.t(), term(), pid() | nil) ::
  HTTP.Response.t() | {:error, term()}
```

# `prepare`

```elixir
@callback prepare(HTTP.Request.t(), term()) :: {:ok, term()} | {:error, term()}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
