OxL Reference

method Reply.withHeader

A copy of the reply with one more header (headers are added, not replaced).

Example:

oxl✓ checked in CI
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) -> Reply

Since. 1.0.0-beta

Parameters

NameType
namestr
valuestr

Returns

Reply

Effects

none declared (pure unless the body says otherwise)

Defined in: std/http/http.oxl:2945

See also