Merge pull request #92 from theduke/basic-auth-requestbuilder

Added basic_auth helper on RequestBuilder
This commit is contained in:
Sean McArthur
2017-05-08 16:35:27 -07:00
committed by GitHub

View File

@@ -175,6 +175,14 @@ impl RequestBuilder {
self
}
/// Enable HTTP basic authentication.
pub fn basic_auth(self, username: String, password: Option<String>) -> RequestBuilder {
self.header(::header::Authorization(::header::Basic{
username: username,
password: password,
}))
}
/// Set the request body.
pub fn body<T: Into<Body>>(mut self, body: T) -> RequestBuilder {
self.body = Some(Ok(body.into()));