# `CorvoNfse.HTTP`
[🔗](https://github.com/corvo-technology/corvo-nfse-elixir/blob/main/lib/corvo_nfse/http.ex#L1)

Behaviour for the HTTP layer used by `CorvoNfse.Transport`.

The default adapter is `CorvoNfse.HTTP.Finch`. Inject your own adapter with
`CorvoNfse.new(http: MyAdapter)` - useful for tests (Mox), recording proxies
or alternative HTTP stacks.

Adapters must never raise: they return `{:ok, response}` on any HTTP
response (including 4xx/5xx) and `{:error, reason}` for transport-level
failures such as refused connections or timeouts. The transport maps both
onto `CorvoNfse.Error`.

# `method`

```elixir
@type method() :: :get | :post | :patch | :delete
```

# `request`

```elixir
@type request() :: %{
  method: method(),
  url: String.t(),
  headers: [{String.t(), String.t()}],
  body: iodata() | nil,
  receive_timeout: pos_integer(),
  finch: atom() | nil
}
```

# `response`

```elixir
@type response() :: %{
  status: pos_integer(),
  headers: [{String.t(), String.t()}],
  body: binary()
}
```

# `send`

```elixir
@callback send(request()) :: {:ok, response()} | {:error, term()}
```

---

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