Expand description
Lightweight middleware/interceptor chain for the HTTP client.
Provides a ClientMiddleware trait that lets callers observe and instrument
each request/response round-trip without the complex type-erasure required
by a full tower::Service composition.
§Example
use oxihttp_client::{Client, middleware::{ClientMiddleware, LoggingMiddleware}};
let client = Client::builder()
.with_middleware(LoggingMiddleware::new("my-client"))
.build()
.expect("client build");Structs§
- Logging
Middleware - Logging middleware: emits one line to
stderrbefore each request and one line after each response. - Request
Context - Request context passed to
ClientMiddleware::before_request. - Response
Context - Response context passed to
ClientMiddleware::after_response. - Timing
Middleware - Timing middleware: invokes a user-supplied callback with the elapsed duration after each successful response.
Traits§
- Client
Middleware - A request/response interceptor that can observe (but not modify) each HTTP round-trip.