let fut = Box::pin(async move {
let r = async { tokio::time::timeout( c.ic.http_timeout, async {
let resp = resp.await.context("make request")?;
- if ! resp.status().is_success() {
- throw!(anyhow!("HTTP error status {}", &resp.status()));
- }
+ let status = resp.status();
let resp = resp.into_body();
// xxx: some size limit to avoid mallocing the universe
let resp = hyper::body::to_bytes(resp).await
.context("HTTP error fetching response body")?;
+ if ! status.is_success() {
+ // xxx get body and log it
+ throw!(anyhow!("HTTP error status={} body={:?}",
+ &status, String::from_utf8_lossy(&resp)));
+ }
+
Ok::<_,AE>(resp)
}).await? }.await;