fix(hyper-up): compatibility with hyper 0.6.4

* Signature of `client::Response` changed and now requires a
  `hyper::Url` as well.

 Closes #123
This commit is contained in:
Sebastian Thiel
2015-07-15 09:45:15 +02:00
parent 2575d5abe7
commit e129a7d3ae
2 changed files with 7 additions and 10 deletions

View File

@@ -26,7 +26,7 @@ name = "${util.program_name()}"
% endif
[dependencies]
hyper = ">= 0.6.0"
hyper = ">= 0.6.4"
## Must match the one hyper uses, otherwise there are duplicate similarly named `Mime` structs
mime = "0.0.12"
serde = ">= 0.4.1"

View File

@@ -703,15 +703,12 @@ else {
if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() {
should_ask_dlg_for_url = false;
upload_url_from_server = false;
let mut response = hyper::client::Response::new(Box::new(cmn::DummyNetworkStream));
match response {
Ok(ref mut res) => {
res.status = hyper::status::StatusCode::Ok;
res.headers.set(Location(upload_url.as_ref().unwrap().clone()))
}
_ => unreachable!(),
}
response
let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap();
hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| {
res.status = hyper::status::StatusCode::Ok;
res.headers.set(Location(upload_url.as_ref().unwrap().clone()));
Ok(res)
})
} else {
% endif
<%block filter="indent_by(resumable_media_param and 4 or 0)">\