OxL Reference

method Reply.bytes

A reply with a binary body and the given Content-Type.

Example:

oxl✓ checked in CI
use std.http { Reply }

fn main() io {
  let r = Reply.bytes(b"\x89PNG", "image/png")
  print("{r.headers[0].value} {r.body.len()}")
}
Output
image/png 4
pub(api) static fn bytes(body: bytes, contentType: str = "application/octet-stream", status: i64 = 200) -> Reply

Since. 1.0.0-beta

Parameters

NameType
bodybytes
contentTypestr = "application/octet-stream"
statusi64 = 200

Returns

Reply

Effects

none declared (pure unless the body says otherwise)

Defined in: std/http/http.oxl:2726

See also