Skip to main content

assert_body_contains

Macro assert_body_contains 

Source
macro_rules! assert_body_contains {
    ($response:expr, $expected:expr) => { ... };
    ($response:expr, $expected:expr, $($msg:tt)+) => { ... };
}
Expand description

Asserts that a test response body contains the expected substring.

§Examples

use fastapi_core::assert_body_contains;

let response = client.get("/hello").send();
assert_body_contains!(response, "Hello");

With custom message:

assert_body_contains!(response, "error", "Response should contain error message");