definy.rpc-request-json
- description
- The RPC request as JSON: the CBOR body (application/cbor) is read with definy.cbor-to-json, any other body as JSON
- type
Fn(request: @http.request) -> @definy.request-json
- expression
fn(request$0) =>
match @definy.request-is-cbor(request: $0) {
false =>
@definy.request-json-of(request: $0),
true =>
match @cbor.decode(bytes: $0.body) {
#some(item$1) =>
match $1 {
#map(_) =>
#json<@definy.request-json>(@definy.cbor-to-json(item: $1)),
_ =>
#invalid<@definy.request-json>("request body must be a CBOR map")
},
#none(_) =>
#invalid<@definy.request-json>("request body must be CBOR")
}
}- visibility
- public
definy.rpc-request-json (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: icMXLM9DHfsOQUVdrUEDZdsnXWlMHTx8ZJdC3OtKnxM
content hash: xJ49MA9LeINB1chd-MEXNN0CDwfLGqq9CDbcnuBSi1U