package tiny_httpd

  1. Overview
  2. Docs

Module Tiny_httpd_server.HeadersSource

Sourcetype t = (string * string) list

The header files of a request or response.

Neither the key nor the value can contain '\r' or '\n'. See https://tools.ietf.org/html/rfc7230#section-3.2

Sourceval empty : t

Empty list of headers.

  • since 0.5
Sourceval get : ?f:(string -> string) -> string -> t -> string option

get k headers looks for the header field with key k.

  • parameter f

    if provided, will transform the value before it is returned.

Sourceval set : string -> string -> t -> t

set k v headers sets the key k to value v. It erases any previous entry for k

Sourceval remove : string -> t -> t

Remove the key from the headers, if present.

Sourceval contains : string -> t -> bool

Is there a header with the given key?

Sourceval pp : Format.formatter -> t -> unit

Pretty print the headers.

OCaml

Innovation. Community. Security.