View Source Assent.HTTPAdapter behaviour (Assent v0.2.1)

HTTP adapter helper module.

usage

Usage

defmodule MyApp.MyHTTPAdapter do
  @behaviour Assent.HTTPAdapter

  @impl true
  def request(method, url, body, headers, opts) do
    # ...
  end
end

Link to this section Summary

Functions

Sets a user agent header

Link to this section Types

@type body() :: binary() | nil
@type headers() :: [{binary(), binary()}]
@type method() :: :get | :post

Link to this section Callbacks

Link to this callback

request(method, binary, body, headers, t)

View Source
@callback request(method(), binary(), body(), headers(), Keyword.t()) ::
  {:ok, map()} | {:error, any()}

Link to this section Functions

@spec user_agent_header() :: {binary(), binary()}

Sets a user agent header

The header value will be Assent-VERSION with VERSION being the :vsn of :assent app.