Http module

read_bytes

procedureextensionexperimentalSource

The whole body, in memory from the context allocator (release it with free).

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);

    bytes, error := read_bytes(*response);
    defer free(bytes.data);
    assert(error.kind == .NONE && bytes.count == 5);
}

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

read_bytes :: (response: *Client_Response) -> ([] u8, Client_Error)

Parameters

response: *Client_Response

Returns

[] u8

See also