Skip to content
Playground(another site)

bynk.http.stream_body_not_raw

Error A Stream[Bytes] body is on a handler that is not @raw.

A Stream[Bytes] body is a request body handed to the handler chunk by chunk, so the router must be told to leave it as octets: without @raw a body is JSON (or base64 inside JSON for Bytes), which has no streamed form. Add @raw(contentType: "…") and a @limit, or take the body as a value (T, or Bytes) to have it read whole.

Example

@limit(maxBody: 1_000_000)
on PUT("/blobs/:id") (id: String, body: Stream[Bytes]) -> Effect[HttpResult[()]] by v: Visitor { … } // ✗ not `@raw`
@raw(contentType: "application/octet-stream")
@limit(maxBody: 1_000_000)
on PUT("/blobs/:id") (id: String, body: Stream[Bytes]) -> Effect[HttpResult[()]] by v: Visitor { … } // ✓

In the Book

See also

  • Every code in its category, HTTP, on the diagnostic index.
  • bynk explain bynk.http.stream_body_not_raw shows the same from the installed toolchain, without a network.