method Reply.json
A body that is already JSON text.
Example:
use std.http { Reply }
fn main() io {
let r = Reply.json("{{\"id\":1,\"name\":\"tea\"}}")
print("{r.headers[0].value} {Utf8.decode(r.body)!}")
}Output
application/json {"id":1,"name":"tea"}pub(api) static fn json(body: str, status: i64 = 200) -> ReplySince. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
body | str |
status | i64 = 200 |
Returns
Effects
none declared (pure unless the body says otherwise)
Defined in: std/http/http.oxl:2710