Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/header.ml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ let add h k v =
try StringMap.add k (v::(StringMap.find k h)) h
with Not_found -> StringMap.add k [v] h

let add_list h l =
List.fold_left (fun h (k, v) -> add h k v) h l

let add_multi h k l =
List.fold_left (fun h v -> add h k v) h l

let add_opt h k v =
match h with
|None -> init_with k v
Expand Down
6 changes: 6 additions & 0 deletions lib/header.mli
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ val init_with : string -> string -> t
(** Add a key and value to an existing header map *)
val add : t -> string -> string -> t

(** Add multiple key and value pairs to an existing header map *)
val add_list : t -> (string * string) list -> t

(** Add multiple values to a key in an existing header map *)
val add_multi : t -> string -> string list -> t

(** Given an optional header, either update the existing one with
a key and value, or construct a fresh header with those values if
the header is [None] *)
Expand Down