Goth.HTTPClient behaviour (Goth v1.3.0-rc.3) View Source
Specification for a Goth HTTP client.
The client is configured as a {module, initial_state}
tuple where the module
implements this behaviour and initial_state
is returned by the init/1
callback.
The init/1
callback gives an opportunity to perform some initialization tasks just once.
Link to this section Summary
Link to this section Types
Specs
body() :: binary()
Specs
Specs
initial_state() :: map()
Specs
method() :: atom()
Specs
status() :: non_neg_integer()
Specs
url() :: binary()
Link to this section Callbacks
Specs
init(opts :: keyword()) :: initial_state()
Callback to initialize the given HTTP client.
The returned initial_state
needs to be a map and will be given to request/6
.
Specs
request(method(), url(), [header()], body(), opts :: keyword(), initial_state()) :: {:ok, %{status: status(), headers: [header()], body: body()}} | {:error, Exception.t()}
Callback to make an HTTP request.