Skip to content

Commit

Permalink
Implement Request::bearer_auth for wasm32
Browse files Browse the repository at this point in the history
  • Loading branch information
Gottox authored and seanmonstar committed Jul 6, 2020
1 parent 1a2c102 commit af9fc5c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/wasm/request.rs
Expand Up @@ -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 {
Expand Down

0 comments on commit af9fc5c

Please sign in to comment.