Http module

expect_text

procedureextensionexperimentalSource

The body is exactly expected.

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_text(response, "hello"));
}

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

expect_text :: (
    response: Client_Response,
    expected: string,
    loc := #caller_location
) -> bool

Parameters

response: Client_Response
expected: string
loc := #caller_location

Returns

bool

See also