method Reply.bytes
A reply with a binary body and the given Content-Type.
Example:
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) -> ReplySince. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
body | bytes |
contentType | str = "application/octet-stream" |
status | i64 = 200 |
Returns
Effects
none declared (pure unless the body says otherwise)
Defined in: std/http/http.oxl:2726