From a1a119276a8bc405b0f85eae2ce08b3a06d21ecc Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Mon, 25 May 2026 20:58:13 -0400 Subject: [PATCH] test --- .../common_responses/common_web_error.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/service/web/storyteller_web/src/http_server/common_responses/common_web_error.rs b/crates/service/web/storyteller_web/src/http_server/common_responses/common_web_error.rs index 50fba61a9a..8aaebb97ba 100644 --- a/crates/service/web/storyteller_web/src/http_server/common_responses/common_web_error.rs +++ b/crates/service/web/storyteller_web/src/http_server/common_responses/common_web_error.rs @@ -485,6 +485,20 @@ mod tests { assert_eq!(error.status_code(), StatusCode::PAYMENT_REQUIRED); } + #[test] + fn too_many_requests_returns_429() { + let error = CommonWebError::TooManyRequests; + assert_eq!(error.status_code(), StatusCode::TOO_MANY_REQUESTS); + assert!(!error.is_server_error()); + assert!(error.cause().is_none()); + + let response = error.error_response(); + let bytes = response.into_body().try_into_bytes().unwrap(); + let body = String::from_utf8(bytes.to_vec()).unwrap(); + assert!(body.contains("\"error_code\":429")); + assert!(body.contains("\"error_code_str\":\"Too Many Requests\"")); + } + #[test] fn uncaught_io_error_returns_500_and_hides_cause() { let io_err = std::io::Error::new(std::io::ErrorKind::Other, "disk exploded");