Fix panicking when passed a file:// URL

Closes #347
This commit is contained in:
Sean McArthur
2018-09-18 12:42:49 -07:00
parent 68d012e954
commit 610cdd266c
5 changed files with 50 additions and 20 deletions

View File

@@ -291,10 +291,9 @@ impl Client {
///
/// This method fails whenever supplied `Url` cannot be parsed.
pub fn request<U: IntoUrl>(&self, method: Method, url: U) -> RequestBuilder {
let req = match url.into_url() {
Ok(url) => Ok(Request::new(method, url)),
Err(err) => Err(::error::from(err)),
};
let req = url
.into_url()
.map(move |url| Request::new(method, url));
RequestBuilder::new(self.clone(), req)
}