armature-http-client

Crates.ioarmature-http-client
lib.rsarmature-http-client
version0.1.1
created_at2025-12-26 20:39:10.749042+00
updated_at2025-12-30 22:13:56.237029+00
descriptionHTTP client with retry, circuit breaker, and timeout support for Armature
homepagehttps://pegasusheavy.github.io/armature
repositoryhttps://github.com/pegasusheavy/armature
max_upload_size
id2006218
size107,317
Joseph R. Quinn (quinnjr)

documentation

README

armature-http-client

HTTP client for the Armature framework.

Features

  • Retry Logic - Automatic retries with backoff
  • Circuit Breaker - Fail fast on repeated failures
  • Timeouts - Request and connection timeouts
  • Connection Pooling - Efficient connection reuse
  • Interceptors - Request/response middleware

Installation

[dependencies]
armature-http-client = "0.1"

Quick Start

use armature_http_client::HttpClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = HttpClient::new()
        .timeout(Duration::from_secs(30))
        .retry(3)
        .build();

    // GET request
    let response = client.get("https://api.example.com/users")
        .send()
        .await?;

    // POST with JSON
    let user = client.post("https://api.example.com/users")
        .json(&CreateUser { name: "John" })
        .send()
        .await?;

    Ok(())
}

Circuit Breaker

let client = HttpClient::new()
    .circuit_breaker(CircuitBreakerConfig {
        failure_threshold: 5,
        success_threshold: 2,
        timeout: Duration::from_secs(30),
    })
    .build();

License

MIT OR Apache-2.0

Commit count: 0

cargo fmt