From 60295dd0fc4f247145d683cbbb16d2374bb58eae Mon Sep 17 00:00:00 2001 From: theduke Date: Tue, 23 May 2017 23:59:53 +0200 Subject: [PATCH] Improve type signature of RequestBuilder::basic_auth(). Use Into for both arguments to make the API more convenient. --- src/client.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/client.rs b/src/client.rs index 63d83c6..41bc82d 100644 --- a/src/client.rs +++ b/src/client.rs @@ -203,10 +203,12 @@ impl RequestBuilder { } /// Enable HTTP basic authentication. - pub fn basic_auth(self, username: String, password: Option) -> RequestBuilder { + pub fn basic_auth(self, username: U, password: Option

) -> RequestBuilder + where U: Into, P: Into + { self.header(::header::Authorization(::header::Basic{ - username: username, - password: password, + username: username.into(), + password: password.map(|p| p.into()), })) }