# `Premailex.HTTPAdapter`
[🔗](https://github.com/danschultzer/premailex/blob/v1.0.0/lib/premailex/http_adapter.ex#L1)

HTTP client adapter behaviour.

## Usage

    defmodule MyHTTPAdapter do
      @behaviour Premailex.HTTPAdapter

      @impl true
      def request(method, url, body, headers, opts) do
        # Implement your HTTP request logic here using your preferred HTTP client library.
        # Return {:ok, response} or {:error, reason}.
      end
    end

Configure Premailex to use a custom adapter:

    config :premailex,
      http_adapter: MyHTTPAdapter

# `body`

```elixir
@type body() :: binary() | nil
```

# `headers`

```elixir
@type headers() :: [{binary(), binary()}]
```

# `method`

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

# `response`

```elixir
@type response() :: %{status: non_neg_integer(), headers: headers(), body: binary()}
```

An HTTP response returned by an adapter's `c:request/5`
callback.

# `request`

```elixir
@callback request(method(), binary(), body(), headers(), Keyword.t()) ::
  {:ok, response()} | {:error, any()}
```

Makes an HTTP request.

# `user_agent_header`

```elixir
@spec user_agent_header() :: {binary(), binary()}
```

Returns a `User-Agent` header tuple for use in HTTP requests.

---

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