Daraja.HTTPClient.Finch (daraja v0.1.0)

Copy Markdown View Source

Default HTTP client implementation using Finch.

To use this adapter, start a Finch pool in your application's supervision tree. The pool name defaults to Daraja.Finch but can be overridden via config:

# config/config.exs
config :daraja, :finch_name, MyApp.Finch

Start the pool under the configured name:

children = [
  {Finch, name: MyApp.Finch}
]

If the pool is not running, request/4 returns {:error, {:finch_pool_not_started, pool}}.

Configure Daraja to use this adapter (this is the default, so the config is optional):

config :daraja, :http_client, Daraja.HTTPClient.Finch

Timeouts

Requests use receive_timeout from config (default 10_000 ms):

config :daraja, :http_receive_timeout, 10_000

TLS

Requests use Finch's default SSL settings, which validate server certificates against the operating system's CA bundle. For certificate pinning or custom trust stores, implement Daraja.HTTPClient and configure :http_client to point at your adapter.