macro_rules! assert_response {
($conn:expr_2021, $status:expr_2021, $body:expr_2021) => { ... };
($conn:expr_2021, $status:expr_2021) => { ... };
($conn:expr_2021, $status:expr_2021, $body:expr_2021, $($header_name:literal => $header_value:expr_2021,)+) => { ... };
($conn:expr_2021, $status:expr_2021, $body:expr_2021, $($header_name:literal => $header_value:expr_2021),*) => { ... };
}Expand description
combines several other assertions. this assertion can be used to assert: just a status code, a status code and a response body, or a status code, a response body, and any number of headers
use trillium_testing::prelude::*;
async fn handler(conn: Conn) -> Conn {
conn.with_body("just tea stuff here")
.with_status(418)
.with_response_header("server", "zojirushi")
}
assert_response!(get("/").on(&handler), 418);
assert_response!(get("/").on(&handler), Status::ImATeapot);
assert_response!(get("/").on(&handler), 418, "just tea stuff here");
assert_response!(get("/").on(&handler), Status::ImATeapot, "just tea stuff here");
assert_response!(
get("/").on(&handler),
Status::ImATeapot,
"just tea stuff here",
"server" => "zojirushi",
"content-length" => "19"
);