Skip to content
Playground(another site)

bynk.http.raw_bad_content_type

Error A @raw annotation's contentType is missing or not a type/subtype (or "*/*") string literal.

@raw(contentType: …) is the media type the route accepts: the router compares it, ignoring parameters such as charset, with each request's Content-Type and answers 415 on a mismatch. So it is required, and must be a string literal of the form type/subtype. Write "image/png", or "*/*" to accept any type.

Example

@raw(contentType: "png") // ✗ not `type/subtype`
@limit(maxBody: 1_000_000)
on POST("/avatars") (body: Bytes) -> Effect[HttpResult[String]] by v: Visitor { … }
@raw(contentType: "image/png") // ✓
const Png: String = "image/png"
@raw(contentType: Png) // ✓ a `String` constant bound to a literal
@limit(maxBody: 1_000_000)
on POST("/icons") (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_bad_content_type shows the same from the installed toolchain, without a network.