Merge pull request #92 from theduke/basic-auth-requestbuilder
Added basic_auth helper on RequestBuilder
This commit is contained in:
@@ -175,6 +175,14 @@ impl RequestBuilder {
|
|||||||
self
|
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.
|
/// Set the request body.
|
||||||
pub fn body<T: Into<Body>>(mut self, body: T) -> RequestBuilder {
|
pub fn body<T: Into<Body>>(mut self, body: T) -> RequestBuilder {
|
||||||
self.body = Some(Ok(body.into()));
|
self.body = Some(Ok(body.into()));
|
||||||
|
|||||||
Reference in New Issue
Block a user