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()}")
}Output
3
pub(api) fn withHeader(name: str, value: str) -> ReplySince. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
name | str |
value | str |
Returns
Effects
none declared (pure unless the body says otherwise)
Defined in: std/http/http.oxl:2945