Temper.Push.HTTPClient behaviour (temper v0.4.0)

Copy Markdown View Source

The transport under Temper.Push.Adapters.HTTP: one POST of a body.

Behind a behaviour so tests replace it. The implementation is read from config :temper, :push_http_client and defaults to Temper.Push.Httpc (OTP's :httpc, so Temper needs no HTTP dependency).

Summary

Callbacks

POSTs body to url with headers. Any status is {:ok, status, body}; only a failure to talk to the server is an error.

Functions

The configured implementation.

Types

header()

@type header() :: {String.t(), String.t()}

Callbacks

post(url, headers, body)

@callback post(url :: String.t(), headers :: [header()], body :: binary()) ::
  {:ok, pos_integer(), binary()} | {:error, term()}

POSTs body to url with headers. Any status is {:ok, status, body}; only a failure to talk to the server is an error.

Functions

impl()

@spec impl() :: module()

The configured implementation.