Skip to content
Playground(another site)

bynk.http.limit_bad_max_body

Error A @limit annotation's maxBody is missing or not a positive Int literal.

@limit sets the byte ceiling above which the router answers 413, so it must give a maxBody, and only the author can know the right one: it is a positive Int literal counting bytes. There is no size literal yet, so "1MB" or 1.mb is refused; write the count, 1_048_576 for 1 MiB. The service-wide default is limits { maxBody: … }.

Example

@limit(maxBody: "1MB") // ✗ a byte count, not a string
on POST("/notes") (body: Note) -> Effect[HttpResult[String]] by v: Visitor { … }
@limit(maxBody: 1_048_576) // ✓ 1 MiB
on POST("/notes") (body: Note) -> Effect[HttpResult[String]] by v: Visitor { … }
const NoteCap: Int = 1_048_576
@limit(maxBody: NoteCap) // ✓ an `Int` constant bound to a literal
on POST("/drafts") (body: Note) -> 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.limit_bad_max_body shows the same from the installed toolchain, without a network.