View Source Kadena.Chainweb.Client.Spec behaviour (Kadena v0.19.1)

Specifies expected behaviour of an HTTP client.

Kadena allows you to use your HTTP client of choice, provided that it can be coerced into complying with this module's specification. The default is :hackney.

Link to this section Summary

Link to this section Types

@type body() :: binary()
@type headers() :: [{binary(), binary()}, ...]
@type method() :: :get | :post | :put | :delete
@type options() :: Keyword.t()
@type response() :: {:ok, map()}
@type response_error() :: {:error, Kadena.Chainweb.Error.t()}
@type status() :: non_neg_integer()

Link to this section Callbacks

Link to this callback

request(method, url, headers, body, options)

View Source
@callback request(
  method :: method(),
  url :: binary(),
  headers :: headers(),
  body :: binary(),
  options :: options()
) :: response() | response_error()