The whole body as text, in memory from the context allocator (release it with free). A body
longer than the request's max_response_size is a .TOO_LARGE error and is not read.
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);
text, error := read_text(*response);
defer free(text);
assert(error.kind == .NONE && text == "hello");
}Doesn't run in the browser (skipped on wasm).
read_text :: (response: *Client_Response) -> (string, Client_Error)
Parameters
- response: *Client_Response
Returns
- string