Merge pull request #100 from theduke/improve-basic-auth
Improve type signature of RequestBuilder::basic_auth().
This commit is contained in:
@@ -208,10 +208,12 @@ impl RequestBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Enable HTTP basic authentication.
|
/// Enable HTTP basic authentication.
|
||||||
pub fn basic_auth(self, username: String, password: Option<String>) -> RequestBuilder {
|
pub fn basic_auth<U, P>(self, username: U, password: Option<P>) -> RequestBuilder
|
||||||
|
where U: Into<String>, P: Into<String>
|
||||||
|
{
|
||||||
self.header(::header::Authorization(::header::Basic{
|
self.header(::header::Authorization(::header::Basic{
|
||||||
username: username,
|
username: username.into(),
|
||||||
password: password,
|
password: password.map(|p| p.into()),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user