This commit is contained in:
Mateusz Gruszczyński committed 2026-10-27 09:27:00 +01:00
1 parent 5c2e50ec06
commit 62b7574553
19 files changed
+563 -139

No files matched your search

+16 -1
View File
@@ -86,12 +86,27 @@ mod tests {
StatusCode::INTERNAL_SERVER_ERROR,
"500 - Internal server error",
),
(StatusCode::BAD_GATEWAY, "502 - Bad gateway"),
] {
let page = builtin_gateway_error(code).unwrap();
assert!(page.contains(label));
assert!(page.contains("background: #131615"));
}
let gateway_502 = builtin_gateway_error(StatusCode::BAD_GATEWAY).unwrap();
assert!(gateway_502.contains("<h1>502 - Bad gateway</h1>"));
assert!(gateway_502.contains("The upstream service returned an invalid response."));
assert!(gateway_502.contains("RustProxy"));
assert!(gateway_502.contains("#131615"));
assert!(!gateway_502.contains("Tinyauth"));
// The standard HTTP error registry and its stock pages predate the
// Tinyauth-specific diagnostic pages and must remain unchanged.
assert_eq!(
ERROR_CODES,
[400, 401, 403, 404, 408, 413, 429, 500, 502, 503, 504]
);
assert_eq!(
BUILTIN_ERROR_CODES,
[400, 401, 403, 404, 408, 410, 413, 429, 500, 502, 503, 504]
);
assert!(builtin_gateway_error(StatusCode::OK).is_none());
assert!(builtin_application_page(StatusCode::OK).contains("200 - OK"));
assert!(builtin_application_page(StatusCode::CREATED).contains("background: #131615"));