Adds a DELETE route; the template, handler and max_body work as for get. A handler that answers with nothing to say
can return status_only(204).
discard :: (id: Path("id", int)) -> Response {
return status_only(204);
}
main :: () {
app: App;
defer free_app(*app);
delete(*app, "/items/{id}", discard);
api := test_client(*app);
response, _ := delete(api, "/items/7");
defer close(*response);
assert(response.status == 204);
}Doesn't run in the browser (skipped on wasm).
delete :: (
app: *App,
$template: string,
$handler: $H,
max_body := 0,
$loc := #caller_location
)
Adds a DELETE route; the template, handler and max_body work as for get. A handler that answers with nothing to say
can return status_only(204).
Parameters
- app: *App
- $template: string
- $handler: $H
- max_body := 0
- $loc := #caller_location
discard :: (id: Path("id", int)) -> Response {
return status_only(204);
}
main :: () {
app: App;
defer free_app(*app);
delete(*app, "/items/{id}", discard);
api := test_client(*app);
response, _ := delete(api, "/items/7");
defer close(*response);
assert(response.status == 204);
}Doesn't run in the browser (skipped on wasm).
delete :: (
group: *Group($P),
$template: string,
$handler: $H,
max_body := 0,
$loc := #caller_location
)
The delete for a route under a group's prefix.
Parameters
- group: *Group($P)
- $template: string
- $handler: $H
- max_body := 0
- $loc := #caller_location
delete :: (
client: *Client,
url: string,
headers: [] Header_Field = .[]
) -> (Client_Response, Client_Error)
DELETE with no body.
Parameters
- client: *Client
- url: string
- headers: [] Header_Field