# `TwitterViewer.Transport`
[🔗](https://github.com/TwitterViewer/twitterviewer-elixir/blob/v0.1.0/lib/twitterviewer/transport.ex#L1)

How the SDK talks HTTP. A transport is a 5-arity function:

    (method, url, headers, body, timeout_ms) ->
      {:ok, %{status: integer, headers: %{lowercase_name => value}, body: binary}}
      | {:error, :timeout}
      | {:error, reason}

`method` is `:get` or `:post`; `headers` is a list of `{name, value}` strings; `body` is a
JSON string or `nil`. `{:error, :timeout}` becomes a `TwitterViewer.TimeoutError`, any other
`{:error, reason}` a `TwitterViewer.ConnectionError`. The default is
`TwitterViewer.Transport.Httpc`; pass your own (for example one built on Req or Finch, or one
that goes through a proxy) with `TwitterViewer.new(transport: fun)`. The transport must not
retry: retries are the SDK's job.

# `response`

```elixir
@type response() :: %{
  status: non_neg_integer(),
  headers: %{required(String.t()) =&gt; String.t()},
  body: binary()
}
```

# `t`

```elixir
@type t() :: (atom(),
        String.t(),
        [{String.t(), String.t()}],
        binary()
        | nil,
        non_neg_integer() -&gt;
          {:ok, response()} | {:error, term()})
```

---

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