Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Commit

Permalink
Handle invalid response status (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjyr committed Sep 22, 2021
1 parent bcc6c6e commit dcc9700
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/src/http_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ impl HttpClient {
response.await
};
let mut response = response.map_err(|err| err.into_inner())?;
if !response.status().is_success() {
log::debug!("HTTP response status {}", response.status());
return Err(HttpClientError::Http(anyhow::anyhow!(
"Unexpected response status code: {}",
response.status()
)));
}

let response = response.body_string().await.map_err(|err| err.into_inner())?;
log::debug!("Response: {}", response);
Expand Down

0 comments on commit dcc9700

Please sign in to comment.