Up

Module Headers

Signature

module Whitespace : sig .. end
module Name : sig .. end
module Value : sig .. end
type t
val compare : t -> t -> int
val __bin_read_t__ : (int -> t) Core.Std.Bin_prot.Read.reader
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
include String_monoidable.S with type t := t
type t
val to_string_monoid : t -> String_monoid.t
val to_string : t -> string
val hash : t -> int
val empty : t
val append : t -> t -> t
val of_list : whitespace:Whitespace.t -> (Name.t * Value.t) list -> t
val to_list : ?whitespace:Whitespace.t -> t -> (Name.t * Value.t) list
val last : ?whitespace:Whitespace.t -> t -> Name.t -> Value.t option
val find_all : ?whitespace:Whitespace.t -> t -> Name.t -> Value.t list
val names : t -> Name.t list
val add : ?whitespace:Whitespace.t -> t -> name:Name.t -> value:Value.t -> t
val add_all : ?whitespace:Whitespace.t -> t -> (Name.t * Value.t) list -> t
val add_at_bottom : ?whitespace:Whitespace.t -> t -> name:Name.t -> value:Value.t -> t
val add_all_at_bottom : ?whitespace:Whitespace.t -> t -> (Name.t * Value.t) list -> t
val set : ?whitespace:Whitespace.t -> t -> name:Name.t -> value:Value.t -> t
val set_at_bottom : ?whitespace:Whitespace.t -> t -> name:Name.t -> value:Value.t -> t
val filter : ?whitespace:Whitespace.t -> t -> f:(name:Name.t -> value:Value.t -> bool) -> t
val map : ?whitespace:Whitespace.t -> t -> f:(name:Name.t -> value:Value.t -> Value.t) -> t

rewrite header values, preserving original whitespace where possible.

whitespace is used to Value.of_string ?whitespace the ~value before passing to f, and again to Value.to_string ?whitespace the result. If the ~value and f ~name ~value are the same no change will be made (white space is preserved).

Particularly the following is an identity transform: map ~whitespace:`Strip ~f:(fun ~name:_ ~value -> Value.of_string ~whitespace:`Strip value) . By contrast the following will 'normalize' the whitespace on all headers. map ~whitespace:`Keep ~f:(fun ~name:_ ~value -> Value.of_string ~whitespace:`Strip value) .