Skip to content

Commit e129a7d

Browse files
committed
fix(hyper-up): compatibility with hyper 0.6.4
* Signature of `client::Response` changed and now requires a `hyper::Url` as well. Closes #123
1 parent 2575d5a commit e129a7d

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

src/mako/Cargo.toml.mako

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ name = "${util.program_name()}"
2626
% endif
2727
2828
[dependencies]
29-
hyper = ">= 0.6.0"
29+
hyper = ">= 0.6.4"
3030
## Must match the one hyper uses, otherwise there are duplicate similarly named `Mime` structs
3131
mime = "0.0.12"
3232
serde = ">= 0.4.1"

src/mako/api/lib/mbuild.mako

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -703,15 +703,12 @@ else {
703703
if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() {
704704
should_ask_dlg_for_url = false;
705705
upload_url_from_server = false;
706-
let mut response = hyper::client::Response::new(Box::new(cmn::DummyNetworkStream));
707-
match response {
708-
Ok(ref mut res) => {
709-
res.status = hyper::status::StatusCode::Ok;
710-
res.headers.set(Location(upload_url.as_ref().unwrap().clone()))
711-
}
712-
_ => unreachable!(),
713-
}
714-
response
706+
let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap();
707+
hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| {
708+
res.status = hyper::status::StatusCode::Ok;
709+
res.headers.set(Location(upload_url.as_ref().unwrap().clone()));
710+
Ok(res)
711+
})
715712
} else {
716713
% endif
717714
<%block filter="indent_by(resumable_media_param and 4 or 0)">\

0 commit comments

Comments
 (0)