[Router] Derive error status from a failure class; preserve the worker's status (1/3) (#39463)
Co-authored-by: Kangyan Zhou <kangyan.zhou@radixark.ai> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Kangyan Zhou
Claude Opus 5
parent
1fdd6c8921
commit
6de4666e43
@@ -7,7 +7,8 @@
|
||||
//! Without a configured `.timeout(...)` on the reqwest client, a stalled
|
||||
//! backend hangs the axum handler future forever and the test harness
|
||||
//! would just timeout. We assert here that the router returns a fast,
|
||||
//! clean 502 (`upstream_timeout`) instead.
|
||||
//! clean 504 (`upstream_timeout`) instead — a timeout is a gateway timeout,
|
||||
//! the same status class as the stale-deadline cancel.
|
||||
|
||||
use axum::body::Body;
|
||||
use axum::http::{Request, StatusCode};
|
||||
@@ -103,7 +104,7 @@ async fn non_streaming_request_times_out_when_worker_hangs() {
|
||||
elapsed < Duration::from_secs(1),
|
||||
"router must short-circuit on upstream timeout; elapsed {elapsed:?}"
|
||||
);
|
||||
assert_eq!(res.status(), StatusCode::BAD_GATEWAY);
|
||||
assert_eq!(res.status(), StatusCode::GATEWAY_TIMEOUT);
|
||||
assert_eq!(
|
||||
res.headers().get("x-router-error-code").unwrap(),
|
||||
"upstream_timeout"
|
||||
|
||||
Reference in New Issue
Block a user