Expand description
reqx is an internal HTTP transport crate for API SDKs with HTTP/1.1 + HTTP/2 support.
§Quick Start
use std::time::Duration;
use reqx::prelude::{Client, RetryPolicy};
use serde::Deserialize;
#[derive(Debug, Deserialize)]
struct CreateItemResponse {
id: String,
}
let client = Client::builder("https://api.example.com")
.client_name("my-sdk")
.request_timeout(Duration::from_secs(3))
.total_timeout(Duration::from_secs(8))
.retry_policy(
RetryPolicy::standard()
.max_attempts(3)
.base_backoff(Duration::from_millis(100))
.max_backoff(Duration::from_millis(800)),
)
.build()?;
let created: CreateItemResponse = client
.post("/v1/items")
.idempotency_key("create-item-001")?
.json(&serde_json::json!({ "name": "demo" }))?
.send_json()
.await?;
println!("created id={}", created.id);
Ok(())§Recommended Defaults
- Use
RetryPolicy::standard()for SDK traffic. - Set both request timeout and total timeout.
- For
POSTretries, always setidempotency_key(...).
Modules§
Structs§
- Adaptive
Concurrency Policy - Advanced
Config - Async
Resumable Uploader _async - Blocking
Resumable Uploader - Circuit
Breaker Policy - Client
_async - Client
Builder _async - Metrics
Snapshot - Permissive
Retry Eligibility - Policy
Backoff Source - Primary
Endpoint Selector - Rate
Limit Policy - Redirect
Policy - Request
Context - Response
- Response
Stream _async - Resumable
Upload Checkpoint - Resumable
Upload Options - Resumable
Upload Result - Retry
Budget Policy - Retry
Decision - Retry
Policy - Round
Robin Endpoint Selector - Standard
Body Codec - Strict
Retry Eligibility - System
Clock - Uploaded
Part
Enums§
- Client
Profile - Error
- Error
Code - Part
Checksum Algorithm - Resumable
Upload Error - Server
Throttle Scope - Status
Policy - Timeout
Phase - TlsBackend
- TlsRoot
Store - Transport
Error Kind
Constants§
Traits§
- Async
Resumable Upload Backend _async - Backoff
Source - Blocking
Resumable Upload Backend - Body
Codec - Clock
- Endpoint
Selector - Interceptor
- Observer
- Retry
Classifier - Retry
Eligibility