Macro trillium_testing::prelude::assert_headers
source ยท macro_rules! assert_headers { (@pair, $conn:expr, $header_name:tt, None) => { ... }; (@pair, $conn:expr, $header_name:tt, $header_value:expr) => { ... }; ($conn:expr, $($header_name:tt => $header_value:tt,)+) => { ... }; ($conn:expr, $($header_name:tt => $header_value:tt),*) => { ... }; }
Expand description
asserts any number of response headers
use trillium_testing::prelude::*;
async fn handler(conn: Conn) -> Conn {
conn.ok("headers")
.with_response_header("server", "special-custom-server")
.with_response_header("request-id", "10")
}
assert_headers!(get("/").on(&handler), "server" => "special-custom-server");
assert_headers!(
get("/").on(&handler),
"server" => "special-custom-server",
"request-id" => "10",
"content-length" => "7"
);