Http module

expect_body_contains

procedureextensionexperimentalSource

The body contains needle.

Example
hello :: () -> string {
    return "hello";
}

main :: () {
    app: App;
    defer free_app(*app);

    get(*app, "/hello", hello);

    api := test_client(*app);

    response, _ := get(api, "/hello");
    defer close(*response);

    assert(expect_body_contains(response, "ell"));
}

Doesn't run in the browser (skipped on wasm).

expect_body_contains :: (
    response: Client_Response,
    needle: string,
    loc := #caller_location
) -> bool

Parameters

response: Client_Response
needle: string
loc := #caller_location

Returns

bool

See also