This commit is contained in:
Mateusz Gruszczyński committed 2026-10-08 15:59:37 +02:00
1 parent 65e082b9d1
commit 76cb4acef0
72 files changed
+6134 -4709

No files matched your search

+16
View File
@@ -41,6 +41,22 @@ mod tests {
assert!(response.extensions().get::<PageServed>().is_some());
}
#[tokio::test]
async fn static_vhost_page_can_serve_html_with_503_status() {
let page = Page {
kind: Kind::Html,
html: "<h1>Maintenance</h1>".into(),
status: Some(503),
};
page.validate().unwrap();
let response = page.serve(&Method::GET, StatusCode::OK);
assert_eq!(response.status(), StatusCode::SERVICE_UNAVAILABLE);
assert_eq!(
response.into_body().collect().await.unwrap().to_bytes(),
"<h1>Maintenance</h1>"
);
}
#[test]
fn builtin_gateway_pages_cover_edge_policy_and_gateway_errors() {
assert!(builtin_gateway_error(StatusCode::UNAUTHORIZED)