Skip to content

Commit 0526f61

Browse files
authored
Merge pull request #1 from KyleLeneau/add-string-url-to-builder
Adding a String constructor method for Client
2 parents df61383 + 94ef9ad commit 0526f61

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/target
22
**/*.rs.bk
3-
Cargo.lock
3+
Cargo.lock
4+
.idea
5+
.DS_Store

src/client.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::str::from_utf8;
44
use futures::future::{self, Future};
55
use futures::stream::Stream;
66
use reqwest as r;
7-
use reqwest::r#async as ra;
7+
use reqwest::{r#async as ra, Url};
88

99
/*
1010
* TODO remove debug output
@@ -126,10 +126,8 @@ impl Client {
126126
///
127127
/// [`ClientBuilder`]: struct.ClientBuilder.html
128128
/// [`.stream()`]: #method.stream
129-
pub fn for_url<U: r::IntoUrl>(url: U) -> Result<ClientBuilder> {
130-
let url = url
131-
.into_url()
132-
.map_err(|e| Error::HttpRequest(Box::new(e)))?;
129+
pub fn for_url(url: &str) -> Result<ClientBuilder> {
130+
let url = Url::parse(url).map_err(|e| Error::HttpRequest(Box::new(e)))?;
133131
Ok(ClientBuilder {
134132
url: url,
135133
headers: r::header::HeaderMap::new(),

0 commit comments

Comments
 (0)