pub fn build_http_client() -> ClientWithMiddlewareExpand description
Build a configured HTTP client with smart retry middleware
The client includes:
- Smart Retry Logic: Respects server
Retry-Afterheaders for 429 responses - Exponential Backoff: For server errors (5xx) and network issues
- Timeout: 10 second request timeout
- Max Retries: 5 attempts
ยงExample
use elo::http::build_http_client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = build_http_client();
let response = client.get("https://api.example.com/status").send().await?;
Ok(())
}