Merge pull request #100 from theduke/improve-basic-auth

Improve type signature of RequestBuilder::basic_auth().
This commit is contained in:
Sean McArthur
2017-05-26 13:56:55 -07:00
committed by GitHub

View File

@@ -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()),
})) }))
} }