HTTPower.Adapter.Finch (HTTPower v0.23.1)

Copy Markdown View Source

Finch adapter for HTTPower.

This adapter uses the Finch HTTP client library to make HTTP requests. Finch is a performance-focused HTTP client built on Mint and NimblePool, with explicit connection pooling and excellent performance characteristics.

Features

  • High-performance HTTP/1.1 and HTTP/2 support
  • Explicit connection pooling with configurable pool sizes
  • Built on Mint for low-level HTTP transport
  • Pool-level SSL/TLS and proxy configuration

Configuration

The Finch adapter honors these per-request options:

  • timeout - Receive timeout in seconds (converted to milliseconds for Finch)
  • pool_timeout - Max time in milliseconds to wait to check out a pooled connection (defaults to Finch's own default of 5000 when not set)

Per-request ssl_verify and proxy are not supported

Finch configures TLS verification and proxy at the pool level (baked in at Finch.start_link), not per request — Finch.request/3 has no connection options. Passing ssl_verify: or proxy: per request has no effect with this adapter; configure them on the pool instead (below). Without explicit TLS config the pool inherits Mint's default verify: :verify_peer, so certificates are verified by default. The Req and Tesla adapters honor these options differently — see their docs.

Pool Configuration

Configure Finch pools — including TLS and proxy — globally in your application config (these flow straight into Finch's :pools):

config :httpower, :finch_pools,
  default: [
    size: 10,
    count: System.schedulers_online(),
    conn_opts: [
      transport_opts: [verify: :verify_peer],
      proxy: {:http, "proxy.example.com", 8080, []}
    ]
  ]

Testing

The Finch adapter works seamlessly with HTTPower.Test for mocking HTTP requests in tests. The test interceptor runs before Finch is called, providing adapter-agnostic testing.

Performance

Finch is recommended for high-throughput production scenarios where explicit connection pooling control and maximum performance are priorities. It's built on Mint, the same low-level library that powers Req.