Skip to content
Playground(another site)

bynk.http.body_on_get_or_delete

Error A GET or DELETE handler declares a body parameter.

A GET or DELETE request carries no body by convention, and proxies and some clients drop one, so a handler for either may not declare a body parameter. Send the data in the path or the query string (query: Filter decodes a record from it), or make the route a POST, PUT or PATCH if the client has something to upload. @raw and @form need a body too: bynk.http.raw_on_bodyless, bynk.http.form_on_bodyless.

Example

type Filter = { tag: String }
on GET("/items") (body: Filter) -> Effect[HttpResult[String]] by v: Visitor { … } // ✗ a GET has no body
on GET("/items") (query: Filter) -> Effect[HttpResult[String]] by v: Visitor { … } // ✓ read it from the query string

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.body_on_get_or_delete shows the same from the installed toolchain, without a network.