Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Map of HTTP header key and value(s) associated with them. Since HTTP headers can contain duplicate keys, this structure can return a list of values associated with a single key.
include Sexplib0.Sexpable.S with type t := t
val t_of_sexp : Sexplib0.Sexp.t -> t
val sexp_of_t : t -> Sexplib0.Sexp.t
val init : unit -> t
Construct a fresh, empty map of HTTP headers.
val is_empty : t -> bool
Test whether HTTP headers are empty or not.
val init_with : string -> string -> t
Construct a fresh map of HTTP headers with a single key and value entry.
Add multiple key and value pairs to an existing header map.
Add multiple values to a key in an existing header map.
Given an optional header, either update the existing one with a key and value, or construct a fresh header with those values if the header is None
.
Given a header, update it with the key and value unless the key is already present in the header.
add_opt_unless_exists h k v
updates h
with the key k
and value v
unless the key is already present in the header. If h
is None
then a fresh header is allocated containing the key k
and the value v
.
Remove a key from the header map and return a fresh header set. The original header parameter is not modified.
Replace the value of a key from the header map if it exists, otherwise it adds it to the header map. The original header parameter is not modified.
val mem : t -> string -> bool
Check if a key exists in the header.
val get : t -> string -> string option
Retrieve a key from a header. If the header is one of the set of headers defined to have list values, then all of the values are concatenated into a single string separated by commas and returned. If it is a singleton header, then the first value is selected and no concatenation is performed.
val get_multi : t -> string -> string list
Retrieve all of the values associated with a key
val iter : (string -> string list -> unit) -> t -> unit
val fold : (string -> string -> 'a -> 'a) -> t -> 'a -> 'a
val of_list : (string * string) list -> t
val to_list : t -> (string * string) list
val to_lines : t -> string list
Return header fieds as a list of lines. Beware that each line ends with "\r\n" characters.
val to_string : t -> string
val get_content_range : t -> Stdlib.Int64.t option
val get_media_type : t -> string option
val get_connection_close : t -> bool
val get_acceptable_media_ranges :
t ->
(Accept.media_range * Accept.p list) Accept.qlist
val get_acceptable_charsets : t -> Accept.charset Accept.qlist
val get_acceptable_encodings : t -> Accept.encoding Accept.qlist
val get_acceptable_languages : t -> Accept.language Accept.qlist
val get_transfer_encoding : t -> Transfer.encoding
val add_transfer_encoding : t -> Transfer.encoding -> t
val add_authorization : t -> Auth.credential -> t
val get_authorization : t -> Auth.credential option
val add_authorization_req : t -> Auth.challenge -> t
val is_form : t -> bool
The User-Agent header used by this library, including the version of cohttp.
Prepend user_agent
to the product token already declared in the "User-Agent" field (if any).
val connection : t -> [ `Keep_alive | `Close | `Unknown of string ] option
val pp_hum : Stdlib.Format.formatter -> t -> unit
Human-readable output, used by the toplevel printer