bynk.http.raw_on_bodyless
Error A @raw annotation is placed on a handler that takes no body.
@raw marks a request body as untouched octets, so it belongs on a POST, PUT or PATCH route with a body: Bytes parameter. On a GET, a DELETE or a route with no body there is nothing for it to mark. It is about the request, not the response: to answer with bytes, return Raw(body, contentType). @form on such a route is bynk.http.form_on_bodyless.
Example
@raw(contentType: "image/png") // ✗ a `GET` has no bodyon GET("/avatars/:id") (id: String) -> Effect[HttpResult[String]] by v: Visitor { … }
@raw(contentType: "image/png") // ✓ an upload route@limit(maxBody: 5_000_000)on POST("/avatars") (body: Bytes) -> 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.raw_on_bodylessshows the same from the installed toolchain, without a network.