feat: expose Headers.empty

This commit is contained in:
Simon Cruanes 2020-03-25 22:02:49 -04:00
parent a238a2100b
commit 2435e33df4
2 changed files with 5 additions and 0 deletions

View file

@ -302,6 +302,7 @@ end
module Headers = struct module Headers = struct
type t = (string * string) list type t = (string * string) list
let empty = []
let contains name headers = let contains name headers =
let name' = String.lowercase_ascii name in let name' = String.lowercase_ascii name in
List.exists (fun (n, _) -> name'=n) headers List.exists (fun (n, _) -> name'=n) headers

View file

@ -184,6 +184,10 @@ module Headers : sig
Neither the key nor the value can contain ['\r'] or ['\n']. Neither the key nor the value can contain ['\r'] or ['\n'].
See https://tools.ietf.org/html/rfc7230#section-3.2 *) See https://tools.ietf.org/html/rfc7230#section-3.2 *)
val empty : t
(** Empty list of headers
@since NEXT_RELEASE *)
val get : ?f:(string->string) -> string -> t -> string option val get : ?f:(string->string) -> string -> t -> string option
(** [get k headers] looks for the header field with key [k]. (** [get k headers] looks for the header field with key [k].
@param f if provided, will transform the value before it is returned. *) @param f if provided, will transform the value before it is returned. *)