pub trait HttpClientBuilderExt {
// Required methods
fn with_bearer_auth(self, token: Token) -> Self;
fn with_bearer_auth_header(
self,
token: Token,
header_name: HeaderName,
) -> Self;
}Expand description
Extension trait for adding bearer auth to modkit_http::HttpClientBuilder.
§Example
ⓘ
use modkit_auth::HttpClientBuilderExt;
let token = Token::new(config).await?;
let client = HttpClientBuilder::new()
.with_bearer_auth(token)
.build()?;Required Methods§
Sourcefn with_bearer_auth(self, token: Token) -> Self
fn with_bearer_auth(self, token: Token) -> Self
Add Authorization: Bearer <token> injection to the HTTP client.
Sourcefn with_bearer_auth_header(self, token: Token, header_name: HeaderName) -> Self
fn with_bearer_auth_header(self, token: Token, header_name: HeaderName) -> Self
Add <header_name>: Bearer <token> injection to the HTTP client.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.