The value of the first header called name (any case), and whether there was one.
header :: (request: *Request, name: string) -> (string, bool)
Parameters
- request: *Request
- name: string
Returns
- string
- bool
header :: (response: *Client_Response, name: string) -> (string, bool)
The value of the first header called name (any case).
Parameters
- response: *Client_Response
- name: string
Returns
- string
- bool
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);
type, found := header(*response, "content-type");
assert(found && type == "text/plain; charset=utf-8");
}Doesn't run in the browser (skipped on wasm).