git-mirage

MirageOS backend for the Git protocol(s)
Library git-mirage
Module Git_mirage . Sync . Http . Web . HTTP . Headers
type name

The type for lower-cased HTTP header field-names.

val name : string -> name

name s is a header name from s.

  • raises Invalid_argument

    if s is not a field-name.

val name_equal : name -> name -> bool

name_equal n n' is true iff n and n' are equal.

Header maps

val empty : headers

empty is the empty header map.

val is_empty : headers -> bool

is_empty hs is true iff hs is the empty header map.

val find : name -> headers -> string option

find n hs is the value of header n in hs (if defined). If n is multi-valued and defined, we return String.concat "," vs where vs are values related to n in hs.

val get : name -> headers -> string

get n hs is like find but

  • raises Invalid_argument

    if n is undefined in hs.

val pp : headers Fmt.t

Pretty-printer of headers.

Header name values

val user_agent : name

User-Agent.

val content_type : name

Content-Type.

val access_control_allow_origin : name

Access-Control-Allow-Origin.

val access_control_allow_methods : name

Access-Control-Allow-Methods.

val access_control_allow_headers : name

Access-Control-Allow-Headers.

val def : name -> string -> headers -> headers

def n v hs is hs with n bound to v.

val def_multi : name -> string list -> headers -> headers

def_multi n vs hs is hs with n bound to the multi-value vs.

  • raises Invalid_argument

    if vs is [].

val merge : headers -> headers -> headers