Lithic.HttpAdapter behaviour (Lithic v1.0.0)

Copy Markdown View Source

Behaviour for the HTTP adapter used by Lithic.Client.

The default implementation delegates to Req. Define a custom adapter in tests or alternative environments by implementing this behaviour and passing adapter: MyAdapter to Lithic.Client.new/1.

Summary

Callbacks

Execute an HTTP request. Returns the response or a transport error.

Types

response()

@type response() :: %{status: non_neg_integer(), body: term(), headers: list()}

Callbacks

request(t, keyword)

@callback request(
  Req.Request.t(),
  keyword()
) :: {:ok, response()} | {:error, term()}

Execute an HTTP request. Returns the response or a transport error.