Shared HTTP client with circuit breaker, retry, and rate limiting for Candil.
Wraps Arrea.CircuitBreaker around all outbound HTTP calls. Uses
Apero.Retry with exponential backoff for transient failures.
Implements a sliding-window rate limiter per breaker name.
Summary
Functions
Performs a GET request.
Performs a POST request with JSON body, protected by circuit breaker and retry.
Performs a POST request with streaming response.
Functions
Performs a GET request.
Options
:timeout_ms— request timeout in milliseconds (default: 60_000)
@spec post_json(binary(), map(), [{binary(), binary()}], keyword()) :: {:ok, map()} | {:error, Candil.Error.t()}
Performs a POST request with JSON body, protected by circuit breaker and retry.
Options
:timeout_ms— request timeout in milliseconds (default: 60_000):retry— enable retry with backoff (default: true):max_retries— maximum retry attempts (default: 3):breaker_name— circuit breaker name (default: from URL host):rate_limit— max requests per second (default: no limit)
Returns
{:ok, map()}— successful response body{:error, Candil.Error.t()}— error with unified error types
@spec post_streaming(binary(), map(), [{binary(), binary()}], keyword(), keyword()) :: {:ok, term()} | {:error, Candil.Error.t()}
Performs a POST request with streaming response.
The callback is called for each SSE data chunk. This function is used
by Candil.Stream to handle streaming responses.
Options
:timeout_ms— request timeout in milliseconds (default: 120_000):into— optional accumulator for streaming