Timber v1.0.13 Timber.Transports.HTTP.Client behaviour

Behavior for custom HTTP clients. If you opt not to use the default Timber HTTP client (Timber.Transports.HTTP.HackneyClient) you can define your own here.

Example

defmodule MyHTTPClient do
  alias Timber.Transports.HTTP.Client

  @behaviour Client

  @spec request(Client.method, Client.url, Client.headers, Client.body, Client.options) ::
    {:ok, Client.status, Client.Headers, Client.body} | {:error, any()}
  def request(method, url, headers, body, opts) do
    # make request here
  end
end

Then specify it in your configuration:

config :timber, :http_transport, http_client: MyHTTPClient

Summary

Types

body()
body() :: IO.chardata
headers()
headers() :: map
method()
method() :: atom
result()
result() :: {:ok, reference} | {:error, atom}
status()
status() :: pos_integer
url()
url() :: String.t

Callbacks

async_request(method, url, headers, body)
async_request(method, url, headers, body) :: result
done?(reference, any)
done?(reference, any) :: boolean
start_link()
start_link() :: {:ok, reference} | {:error, any}