DebugRoute
One route of a tab: its documentation, its parameters, its body, its response, and the handler that answers it. DebugRoutes.get and the other methods of DebugRoutes declare it.
Each parameter that the block declares returns a DebugParam, and the handler reads its value from the DebugCall with it: call[cursor]. The block runs once, when the tab declares its routes; the handler runs for each request.
Properties
Whether the route also takes its body fields as an application/x-www-form-urlencoded form, as curl -d id=dark-mode sends it. Off by default: the route then reads every body as JSON, whatever its content type. A route with a DebugBodyParams.json field can't take a form.
The fields of the route's request body, a JSON object, or a form when acceptsForm is on. When the route declares a required field, an empty body gets a 400 with field body.
A description of the request body, for the OpenAPI document.
A longer description of the route, for the OpenAPI document.
The OpenAPI operationId. Without it, one made from the method and the path, such as getSnapshot, or getRoot for the route at the tab root.
The parameters in the route's path: one for each segment in braces.
The query parameters of the route.
Functions
Adds error statuses that the route's handler can answer, such as 404, to the OpenAPI document. The document already lists the statuses that the server can answer for any route, 400 for a route with a body or a query parameter that the router can refuse, and 404 for a path parameter that does not take every segment.
Sets the handler that answers the route. It runs for each request whose parameters are valid, off the main thread and possibly at the same time as other requests, as DebugTab.handle does.
Says that the route reads its whole body itself, as contentType (such as application/json) that the JSON Schema schema describes. The route then gets a 400 with field body for an empty body, and the handler reads DebugRequest.body. A route can't have both a raw body and body fields.
Describes the route's success response for the OpenAPI document: its description, and the JSON Schema schema of its application/json body, or none. declare adds a body of another content type, such as the bytes of DebugResponse.bytes, and the response's headers: