Macro trillium_testing::assert_body
source · macro_rules! assert_body { ($conn:expr, $body:expr) => { ... }; }
Expand description
assert that the response body is as specified. this assertion requires mutation of the conn.
use trillium_testing::prelude::*;
async fn handler(conn: trillium::Conn) -> trillium::Conn {
conn.ok("it's-a-me, trillium")
}
assert_body!(get("/").on(&handler), "it's-a-me, trillium");
let mut conn = get("/").on(&handler);
assert_body!(&mut conn, "it's-a-me, trillium");
let mut conn = get("/").on(&handler);
assert_body!(conn, "it's-a-me, trillium");
ⓘ
use trillium_testing::prelude::*;
assert_body!(get("/").on(&()), "what body?");
ⓘ
use trillium_testing::prelude::*;
assert_body!(get("/").on(&"beach body"), "winter body");