scratcher v0.1.1 Scratcher.HttpClient behaviour

Module used as Behavior of HTTP Client.

It respects the design of the ex_aws HTTP client module. ExAws.Request.HttpClient

If you want to use a generic HTTP client in your module, you can use this module to avoid having to prepare a Behavior for your module.

Link to this section Summary

Link to this section Types

Link to this type

http_method()

http_method() :: :get | :post | :put | :delete

Link to this section Functions

Link to this function

request(method, url, req_body, headers, http_opts)

Link to this section Callbacks

Link to this callback

request(method, url, req_body, headers, http_opts)

request(
  method :: http_method(),
  url :: binary(),
  req_body :: binary(),
  headers :: [{binary(), binary()}, ...],
  http_opts :: term()
) ::
  {:ok, %{status_code: pos_integer(), body: binary(), headers: list()}}
  | {:error, %{reason: any()}}