HTTPower client with adapter support and advanced features.
This module provides:
- Adapter pattern supporting multiple HTTP clients (Finch, Req, Tesla)
- Test mode request blocking
- Smart retry logic with exponential backoff and jitter
- Clean error handling (never raises exceptions)
- SSL/Proxy configuration support
- Request timeout management
- Request encoding and response decoding via
HTTPower.Codec(json:,form:,raw:)
The client sits above the adapter layer, providing consistent retry logic, error handling, and other production features regardless of the underlying HTTP client.
Compile-Time Configuration
Default adapter and middleware pipeline settings are cached at compile time
via Application.compile_env/3 for performance. Changes to :httpower
application config require recompilation of this module to take effect.
Runtime options passed per-request always take precedence.
Middleware disabled at compile time can't be re-enabled at runtime
The middleware pipeline is assembled at compile time. A middleware set to
enabled: false in compile-time config (e.g. config :httpower, :deduplicate, enabled: false) is excluded from the compiled pipeline
entirely, so enabling it per-request (deduplicate: [enabled: true]) or via
runtime Application.put_env/3 has no effect — it is silently ignored.
To use such a middleware, re-enable it in compile-time config and recompile,
or inject it per-request via the :request_steps option. HTTPower logs a
one-time warning when it detects an attempt to enable a compiled-out
middleware.
Summary
Functions
Makes an HTTP DELETE request.
Makes an HTTP GET request.
Makes an HTTP HEAD request.
Makes an HTTP OPTIONS request.
Makes an HTTP PATCH request.
Makes an HTTP POST request.
Makes an HTTP PUT request.
Functions
@spec delete( String.t(), keyword() ) :: {:ok, HTTPower.Response.t()} | {:error, HTTPower.Error.t()}
Makes an HTTP DELETE request.
@spec get( String.t(), keyword() ) :: {:ok, HTTPower.Response.t()} | {:error, HTTPower.Error.t()}
Makes an HTTP GET request.
@spec head( String.t(), keyword() ) :: {:ok, HTTPower.Response.t()} | {:error, HTTPower.Error.t()}
Makes an HTTP HEAD request.
@spec options( String.t(), keyword() ) :: {:ok, HTTPower.Response.t()} | {:error, HTTPower.Error.t()}
Makes an HTTP OPTIONS request.
@spec patch( String.t(), keyword() ) :: {:ok, HTTPower.Response.t()} | {:error, HTTPower.Error.t()}
Makes an HTTP PATCH request.
@spec post( String.t(), keyword() ) :: {:ok, HTTPower.Response.t()} | {:error, HTTPower.Error.t()}
Makes an HTTP POST request.
@spec put( String.t(), keyword() ) :: {:ok, HTTPower.Response.t()} | {:error, HTTPower.Error.t()}
Makes an HTTP PUT request.