mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 11:15:35 -05:00
feat: expose Headers.empty
This commit is contained in:
parent
a238a2100b
commit
2435e33df4
2 changed files with 5 additions and 0 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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. *)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue