Skip to content
Playground(another site)

bynk.http.cookie_value_undecodable

Error An untyped Cookie literal's value is one the record field that reads that cookie would reject.

An untyped Cookie literal is named for a field of a cookies record, so the next request is read by that field's decoder, and its literal value is one the decoder rejects (an enum is read by its exact, case-sensitive variant name, an Int by its digits, a Bool by true or false). The write compiles and is sent, and then every later request is answered 400. It is an error. Write the cookie from the record, Prefs.theme.cookie(Dark), which checks the value against the field.

Example

Ok("x").withCookie(Cookie { name: "mode", value: "dark" }) // ✗ `Mode` is read as `Light` or `Dark`
Ok("x").withCookie(Cookie { name: "mode", value: "Dark" }) // ✓

In the Book

See also

  • The grammar rule it governs: http_handler.
  • Every code in its category, HTTP, on the diagnostic index.
  • bynk explain bynk.http.cookie_value_undecodable shows the same from the installed toolchain, without a network.