Module middleware

Module middleware 

Source
Expand description

Shared utilities for token renewal.

Structs§

MiddlewareWrapper 🔒
A wrapper that implements [reqwest_middleware::Middleware] by delegating to a MiddlewareExt for token retrieval. We can’t implement [Middleware] directly on MiddlewareExt because [Middleware] is defined in an external crate, so we use this wrapper to bridge between them.

Constants§

TOKEN_RENEW_MARGIN_SECONDS 🔒

Traits§

MiddlewareExt 🔒
Trait used to share over the token attaching middleware. This is implemented by the token management structs, leaving them responsible for handling token retrieval and renewal logic. The middleware simply calls MiddlewareExt::get_token to get the current token (renewing if necessary) and attaches it to the request.