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()}")
}Вывод
image/png 4
pub(api) static fn bytes(body: bytes, contentType: str = "application/octet-stream", status: i64 = 200) -> ReplyС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
body | bytes |
contentType | str = "application/octet-stream" |
status | i64 = 200 |
Возвращает
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/http/http.oxl:2726