Http module

expect_no_header

procedure · 1 overloadSource

The response has no header called name (any case). A failure names the header and its value.

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_no_header(response, "Set-Cookie"));
    assert(expect_header(response, "Content-Type"));
}

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

expect_no_header :: (
    response: Client_Response,
    name: string,
    loc := #caller_location
) -> bool

The response has no header called name (any case). A failure names the header and its value.

Parameters

response: Client_Response
name: string
loc := #caller_location

Returns

bool
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_no_header(response, "Set-Cookie"));
    assert(expect_header(response, "Content-Type"));
}

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

See also