diff --git a/src/lib.rs b/src/lib.rs index 027a8cda5..56d6327e4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -124,11 +124,18 @@ impl <'a> Request<'a> { /// Set the `User-Agent` for this request. By default this will be /// set to cURL's standard user agent. - pub fn user_agent<'b: 'a>(mut self, agent: &str) -> Result { + pub fn user_agent(mut self, agent: &str) -> Result { self.handle.useragent(agent)?; Ok(self) } + /// Set the `Authorization` header to a `Bearer` value with the + /// supplied token. + pub fn bearer_auth(mut self, token: &str) -> Result { + self.headers.append(&format!("Authorization: Bearer {}", token))?; + Ok(self) + } + /// Add a byte-array body to a request using the specified /// `Content-Type`. pub fn body(mut self, content_type: &'a str, data: &'a [u8]) -> Self {