Http.Client behaviour (fnord v0.9.36)

View Source

The single seam between fnord and the HTTP transport (HTTPoison/hackney).

Everything that talks to the network - Http's retrying JSON helpers and the MCP OAuth/discovery modules that need raw control over timeouts and status handling - goes through impl/0 rather than calling HTTPoison directly. That keeps the transport injectable per process tree: tests override :http_client with a Mox mock (see Fnord.TestCase), making the network structurally unreachable from the suite, while production resolves to this module's passthrough implementation.

The callback shapes mirror HTTPoison's so call sites keep matching on %HTTPoison.Response{} / %HTTPoison.Error{}; this module deliberately adds no behavior of its own.

Summary

Functions

Returns the current HTTP transport module. Overridden per process tree via the :http_client config key for unit testing. See Fnord.TestCase.

Types

body()

@type body() :: iodata()

headers()

@type headers() :: [{String.t(), String.t()}]

opts()

@type opts() :: keyword()

result()

url()

@type url() :: String.t()

Callbacks

get(url, headers, opts)

@callback get(url(), headers(), opts()) :: result()

head(url, headers, opts)

@callback head(url(), headers(), opts()) :: result()

post(url, body, headers, opts)

@callback post(url(), body(), headers(), opts()) :: result()

Functions

impl()

@spec impl() :: module()

Returns the current HTTP transport module. Overridden per process tree via the :http_client config key for unit testing. See Fnord.TestCase.