(** adds an header option in the header option list*)
let add_headers header key value =
{ header with
headers = Http_headers.add key value header.headers }
How to understand “header with headers …” ? I guess it “replace” the header.headers with a new headers. Howerver, the passed header should be immutable, shouldnot it ?
Sincerely!
Yes, the passed
headeris (or can be) immutable. This function doesn’t actually modify its argument; it just returns a copy of it, with the copy’sheadersfield “replaced”, as you say.