bynk.http.raw_body_not_bytes
Error The body of a @raw handler is not typed Bytes or Stream[Bytes].
@raw hands the handler the request's octets untouched, so its body must be Bytes (read whole) or Stream[Bytes] (read chunk by chunk); any other type would have to be decoded from them, and decoding is what @raw opts out of. Type body as Bytes and decode it in the handler, or drop @raw to have the router decode a JSON body for you. Without @raw, a Bytes body is base64 inside JSON.
Example
@raw(contentType: "image/png")@limit(maxBody: 1_000_000)on POST("/avatars") (body: String) -> Effect[HttpResult[String]] by v: Visitor { … } // ✗ raw octets are `Bytes`
@raw(contentType: "image/png")@limit(maxBody: 1_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_body_not_bytesshows the same from the installed toolchain, without a network.