From 9ec18b9a5d67f9dd453c45c07a42d2333c4acd08 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Sat, 16 Nov 2024 23:41:27 +0100 Subject: [PATCH] axum: Add `content-length` header assertions to `middleware_adding_body` test (#3033) --- axum/src/routing/tests/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/axum/src/routing/tests/mod.rs b/axum/src/routing/tests/mod.rs index 84e93898..cb2666a9 100644 --- a/axum/src/routing/tests/mod.rs +++ b/axum/src/routing/tests/mod.rs @@ -1091,5 +1091,11 @@ async fn middleware_adding_body() { let client = TestClient::new(app); let res = client.get("/").await; + + let headers = res.headers(); + let header = headers.get("content-length"); + assert!(header.is_some()); + assert_eq!(header.unwrap().to_str().unwrap(), "3"); + assert_eq!(res.text().await, "…"); }