Explorer

definy.request-wants-cbor

description
Whether to answer the request in CBOR: its body is CBOR (definy.request-is-cbor) or it accepts application/cbor (a GET has no body)
type
Fn(request: @http.request) -> Boolean
expression
fn(request$0) =>
  @core.or(
    left: @definy.request-is-cbor(request: $0),
    right: match @http.field-get(fields: $0.headers, name: "accept") {
      #some(value$1) =>
        @std.string-contains(value: @std.ascii-lowercase(value: $1), pattern: "application/cbor"),
      #none(_) =>
        false
    }
  )
visibility
public
definy.request-wants-cbor (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: Zj7nj617rPIgCLc4zSwf8x1y10tQFB7FA52FlO-SEnU
content hash: pDYguDs8alvRxDsJuN3bNk5R9bZNLouVva8kJVe-6LA