We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
set
1 parent c62487e commit 8ba982bCopy full SHA for 8ba982b
src/core/headers.ml
@@ -35,7 +35,15 @@ let get ?(f = fun x -> x) x h =
35
try Some (get_exn ~f x h) with Not_found -> None
36
37
let remove x h = List.filter (fun (k, _) -> not (equal_name_ k x)) h
38
-let set x y h = (x, y) :: List.filter (fun (k, _) -> not (equal_name_ k x)) h
+
39
+let set x y h =
40
+ let h =
41
+ if contains x h then
42
+ remove x h
43
+ else
44
+ h
45
+ in
46
+ (x, y) :: h
47
48
let pp out l =
49
let pp_pair out (k, v) = Format.fprintf out "@[<h>%s: %s@]" k v in
0 commit comments