diff --git a/crates/handler/src/service_route.rs b/crates/handler/src/service_route.rs index 069f071..5eeb1be 100644 --- a/crates/handler/src/service_route.rs +++ b/crates/handler/src/service_route.rs @@ -90,9 +90,13 @@ impl ServiceRouteTable { .headers(header_map.cloned().unwrap_or_default()) .json(&request) .send() - .and_then(|res| async move { res.error_for_status() }) .await?; + if !raw_resp.status().is_success() { + let body = raw_resp.text().await?; + return Err(anyhow::anyhow!("received non-2xx response from service \"{}\", body: \"{}\"", service, body)); + } + let mut headers: HashMap> = HashMap::new(); for (key, val) in raw_resp.headers().iter() { diff --git a/crates/handler/src/shared_route_table.rs b/crates/handler/src/shared_route_table.rs index 82f8cc9..38c9065 100644 --- a/crates/handler/src/shared_route_table.rs +++ b/crates/handler/src/shared_route_table.rs @@ -164,9 +164,9 @@ impl SharedRouteTable { extensions: Default::default(), headers: Default::default(), }) - .unwrap(), + .unwrap_or_default(), ) - .unwrap(); + .unwrap_or_default(); } };