Implement Request::bearer_auth for wasm32

This commit is contained in:
Enno Boland
2020-02-15 17:07:38 +01:00
committed by Sean McArthur
parent 1a2c10256a
commit af9fc5c9d8

View File

@@ -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 {