malomo v0.0.2 Malomo.HTTP behaviour

Behaviour for implementing an HTTP client.

Link to this section Summary

Link to this section Types

Link to this type headers_t()
headers_t() :: [{binary(), binary()}]
Link to this type method_t()
method_t() :: :delete | :get | :post | :put
Link to this type response_t()
response_t() :: %{
  body: binary(),
  headers: headers_t(),
  status_code: pos_integer()
}

Link to this section Callbacks

Link to this callback request(method, url, headers, body, opts)
request(
  method :: method_t(),
  url :: binary(),
  headers :: headers_t(),
  body :: binary(),
  opts :: any()
) :: {:ok, response :: response_t()} | {:error, reason :: any()}