pub trait RequestInitialiser:
'static
+ Send
+ Sync {
// Required method
fn init(&self, req: RequestBuilder) -> RequestBuilder;
}
Expand description
When attached to a ClientWithMiddleware
(generally using with_init
), it is run
whenever the client starts building a request, in the order it was attached.
§Example
use reqwest_middleware::{RequestInitialiser, RequestBuilder};
struct AuthInit;
impl RequestInitialiser for AuthInit {
fn init(&self, req: RequestBuilder) -> RequestBuilder {
req.bearer_auth("my_auth_token")
}
}