Skip to content

Commit

Permalink
Merge pull request #13 from SirVer/master
Browse files Browse the repository at this point in the history
Port to hyper 0.10.
  • Loading branch information
gobwas authored Jan 16, 2017
2 parents 9e7e5bf + 5cf8468 commit b753e98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ default = ["http"]
http = ["hyper"]

[dependencies]
hyper = { version = "0.6.8", optional = true }
hyper = { version = "^0.10.0", optional = true }
log = "0.3.1"
15 changes: 5 additions & 10 deletions src/hurl/hyper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,7 @@ impl Hurl for HyperHurl {
match req.query {
Some(ref query) => {
// if any existing pairs
let existing: Vec<(String, String)> = match url.query_pairs() {
Some(ref existing) => {
existing.clone()
}
_ => {
Vec::new()
}
};
let existing: Vec<(String, String)> = url.query_pairs().map(|(a,b)| (a.to_string(), b.to_string())).collect();

// final pairs
let mut pairs: Vec<(&str, &str)> = Vec::new();
Expand All @@ -81,7 +74,9 @@ impl Hurl for HyperHurl {
}

// set new pairs
url.set_query_from_pairs(pairs.into_iter());
url.query_pairs_mut().clear().extend_pairs(
pairs.iter().map(|&(k, v)| { (&k[..], &v[..]) })
);
}
_ => {}
};
Expand Down Expand Up @@ -113,4 +108,4 @@ impl Hurl for HyperHurl {
}
}
}
}
}

0 comments on commit b753e98

Please sign in to comment.