OxL Справочник OxL
РусскийEnglish

method Reply.bytes

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

Example:

oxl✓ проверяется в CI
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

Параметры

ИмяТип
bodybytes
contentTypestr = "application/octet-stream"
statusi64 = 200

Возвращает

Reply

Эффекты

не объявлены (чистая, пока тело не говорит иное)

Определено в: std/http/http.oxl:2726

См. также