Expand description
Request and response interceptors for the Client.
Interceptors allow modifying outgoing requests and inspecting incoming responses without changing individual call sites.
§Example
use typeway_client::{ClientConfig, RequestInterceptor, ResponseInterceptor};
use std::sync::Arc;
let config = ClientConfig::default()
.request_interceptor(Arc::new(|req| {
req.header("X-Custom", "value")
}))
.response_interceptor(Arc::new(|resp| {
println!("Response status: {}", resp.status());
}));Type Aliases§
- Request
Interceptor - A function that modifies outgoing requests before they are sent.
- Response
Interceptor - A function that inspects responses after they are received.