src/client/http_client.rs: correctly parse error response in download_chunk_list

This commit is contained in:
Dietmar Maurer 2019-05-27 09:35:30 +02:00
parent a1e7cff3ea
commit 7dd1bcac58
1 changed files with 4 additions and 5 deletions

View File

@ -587,13 +587,12 @@ impl BackupClient {
.map_err(Error::from) .map_err(Error::from)
.and_then(move |resp| { .and_then(move |resp| {
let status = resp.status(); let status = resp.status();
if !status.is_success() { if !status.is_success() {
bail!("download chunk list failed with status {}", status); future::Either::A(H2Client::h2api_response(resp).and_then(|_| { bail!("unknown error"); }))
} else {
future::Either::B(future::ok(resp.into_body()))
} }
let (_head, body) = resp.into_parts();
Ok(body)
}) })
.and_then(move |mut body| { .and_then(move |mut body| {