Skip to content
Playground(another site)

bynk.http.cookies_wrong_type

Error An HTTP handler's cookies parameter is not a record type.

cookies is the name the router reserves for the request's cookies. It decodes the Cookie header into the record you name, one field per cookie, and answers 400 when they do not fit, so the parameter must be a record type. Declare the cookies you read as a record, with an Option for each that may be absent. A field a cookie cannot carry is bynk.http.cookies_field_not_stringy.

Example

type Session = { sid: Option[String] }
on GET("/me") (cookies: String) -> Effect[HttpResult[String]] by v: Visitor { … } // ✗ not a record
on GET("/me") (cookies: Session) -> Effect[HttpResult[String]] by v: Visitor { … } // ✓

In the Book

See also

  • Every code in its category, HTTP, on the diagnostic index.
  • bynk explain bynk.http.cookies_wrong_type shows the same from the installed toolchain, without a network.