Honeybadger.HTTPAdapter behaviour (Honeybadger v0.24.1)
View SourceHTTP adapter helper module.
You can configure the HTTP adapter that Honeybadger uses by setting the following option:
http_adapter: Honeybadger.HTTPAdapter.Req
Default options can be set by passing a list of options:
http_adapter: {Honeybadger.HTTPAdapter.Req, [...]}
You can also set the client for the application:
config :honeybadger, :http_adapter, Honeybadger.HTTPAdapter.Req
Usage
defmodule MyApp.MyHTTPAdapter do
@behaviour Honeybadger.HTTPAdapter
@impl true
def request(method, url, body, headers, opts) do
# ...
end
@impl true
def decode_response_body(response, opts) do
# ...
end
end
Summary
Functions
Makes an HTTP request.
Validates that the configured HTTP adapter's dependencies are available.
Types
Callbacks
@callback decode_response_body(Honeybadger.HTTPAdapter.HTTPResponse.t(), Keyword.t()) :: {:ok, Honeybadger.HTTPAdapter.HTTPResponse.t()} | {:error, Honeybadger.InvalidResponseError.t()}
Functions
@spec request(atom(), binary(), binary() | nil, list(), Keyword.t()) :: {:ok, Honeybadger.HTTPAdapter.HTTPResponse.t()} | {:error, Honeybadger.HTTPAdapter.HTTPResponse.t()} | {:error, term()}
Makes an HTTP request.
Options
:http_adapter
- The HTTP adapter to use, defaults to to one of the available adapters (Req is preferred, falling back to Hackney if available)
Validates that the configured HTTP adapter's dependencies are available.
This should be called during application startup to ensure that the configured adapter can be used.