From 2435e33df43ad2b0dc5c4d18eed4f043e72e988c Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Wed, 25 Mar 2020 22:02:49 -0400 Subject: [PATCH] feat: expose `Headers.empty` --- src/Tiny_httpd.ml | 1 + src/Tiny_httpd.mli | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/Tiny_httpd.ml b/src/Tiny_httpd.ml index dcc8c203..73751c5c 100644 --- a/src/Tiny_httpd.ml +++ b/src/Tiny_httpd.ml @@ -302,6 +302,7 @@ end module Headers = struct type t = (string * string) list + let empty = [] let contains name headers = let name' = String.lowercase_ascii name in List.exists (fun (n, _) -> name'=n) headers diff --git a/src/Tiny_httpd.mli b/src/Tiny_httpd.mli index 28689917..7af68f0b 100644 --- a/src/Tiny_httpd.mli +++ b/src/Tiny_httpd.mli @@ -184,6 +184,10 @@ module Headers : sig Neither the key nor the value can contain ['\r'] or ['\n']. 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 (** [get k headers] looks for the header field with key [k]. @param f if provided, will transform the value before it is returned. *)