method Reply.withHeader
A copy of the reply with one more header (headers are added, not replaced).
Example:
use std.http { Reply }
fn main() io {
let r = Reply.text("ok").withHeader("Cache-Control", "no-store").withHeader("Set-Cookie", "a=1")
print("{r.headers.len()}")
}Вывод
3
pub(api) fn withHeader(name: str, value: str) -> ReplyС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
name | str |
value | str |
Возвращает
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/http/http.oxl:2945