Skip to content
Playground(another site)

bynk.http.raw_duplicate

Error A handler carries more than one @raw annotation.

@raw says the route reads its body as untouched bytes and names the one media type it accepts. A handler has one body, so a second @raw has no meaning: the router would have two media types to compare with and nothing to decide between them. Keep one. To accept more than one type, use "*/*", or write a route for each. Another body annotation on the same route is bynk.http.body_kind_conflict.

Example

@raw(contentType: "image/png")
@raw(contentType: "image/jpeg") // ✗ a second `@raw`
@limit(maxBody: 1_000_000)
on POST("/avatars") (body: Bytes) -> Effect[HttpResult[String]] by v: Visitor { … }
@raw(contentType: "*/*") // ✓ one `@raw`, any type
@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_duplicate shows the same from the installed toolchain, without a network.