Explorer

definy.request-is-cbor

description
Whether the body of the request is CBOR (Content-Type: application/cbor). The RPC then answers in CBOR too (docs.connect-rpc)
type
Fn(request: @http.request) -> Boolean
expression
fn(request$0) =>
  match @http.field-get(fields: $0.headers, name: "content-type") {
    #some(value$1) =>
      @std.string-starts-with(value: @std.ascii-lowercase(value: @definy.string-trim(value: $1)), prefix: "application/cbor"),
    #none(_) =>
      false
  }
visibility
public
definy.request-is-cbor (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: 9MnOFRvHwOk2XUMbfU3g84bdsEyzRK0DqhhQ9dqNDS0
content hash: q1qvCNF5fyseTu4-pbQeeVLPb9u3f3MY0a2ylGzi8ww