package brr

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Request and response headers.

Warning. We left out mutable operations out of the interface but remember these objects may mutate under your feet.

Headers

type t

The type for Headers objects.

val mem : Jstr.t -> t -> bool

mem h hs is true iff header h has a value in hs. The lookup is case insensitive.

val find : Jstr.t -> t -> Jstr.t option

find h hs is the value of header h in hs (if any). The lookup is case insensitive.

val fold : (Jstr.t -> Jstr.t -> 'a -> 'a) -> t -> 'a -> 'a

fold f hs acc folds the headers h of hs and their value v with f h v starting with acc. It's unclear but header names are likely lowercased.

Converting

val of_obj : Jv.t -> t

of_obj o uses the keys and values of object o to define headers and their value.

val of_assoc : ?init:t -> (Jstr.t * Jstr.t) list -> t

of_assoc ~init assoc are the headers from init (default si empty) to which the header value pairs of assoc are appended. If a header is defined more than once this either overwrites the previous definition, or appends to the value if if the value can be multi-valued.

val to_assoc : t -> (Jstr.t * Jstr.t) list

to_assoc hs are the headres hs as an assoc list. It's unclear but header names are likely lowercased.