Implement Request::bearer_auth for wasm32
This commit is contained in:
committed by
Sean McArthur
parent
1a2c10256a
commit
af9fc5c9d8
@@ -172,6 +172,16 @@ impl RequestBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
/// Enable HTTP bearer authentication.
|
||||
pub fn bearer_auth<T>(self, token: T) -> RequestBuilder
|
||||
where
|
||||
T: fmt::Display,
|
||||
{
|
||||
let header_value = format!("Bearer {}", token);
|
||||
self.header(crate::header::AUTHORIZATION, header_value)
|
||||
}
|
||||
|
||||
|
||||
/// Set the request body.
|
||||
pub fn body<T: Into<Body>>(mut self, body: T) -> RequestBuilder {
|
||||
if let Ok(ref mut req) = self.request {
|
||||
|
||||
Reference in New Issue
Block a user