value as JSON with Content-Type: application/json. The body is built in the temporary
allocator.
- value: any value the Json module can encode.
- status: the HTTP status code.
response := json(s32.[1, 2, 3]);
assert(response.status == 200);
assert(string.{ response.body.count, response.body.data } == "[1,2,3]");Doesn't run in the browser (skipped on wasm).
json :: (value: $T, status := 200) -> Response
value as JSON with Content-Type: application/json. The body is built in the temporary
allocator.
Parameters
- value: $T
- any value the Json module can encode.
- status := 200
- the HTTP status code.
Returns
response := json(s32.[1, 2, 3]);
assert(response.status == 200);
assert(string.{ response.body.count, response.body.data } == "[1,2,3]");Doesn't run in the browser (skipped on wasm).