package cookie

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type header = string * string

A standard header type used in many web frameworks like Httpaf and Cohttp

val header_of_string : string -> header option

parses "Cookie: foo=bar" into ("Cookie", "foo=bar")

type expires = [
  1. | `Session
  2. | `MaxAge of int64
  3. | `Date of Ptime.t
]

expires describes when a cookie will expire.

  • `Session - nothing will be set
  • `MaxAge - Max-Age will be set with the number
  • `Date - Expires will be set with a date
type same_site = [
  1. | `None
  2. | `Strict
  3. | `Lax
]

The cookie type is a tuple of (name, value)

type t = {
  1. expires : expires;
  2. scope : Uri.t;
  3. same_site : same_site;
  4. secure : bool;
  5. http_only : bool;
  6. value : string * string;
}
val make : ?expires:expires -> ?scope:Uri.t -> ?same_site:same_site -> ?secure:bool -> ?http_only:bool -> cookie -> t

make creates a cookie, it will default to the following values:

val cookies_of_header : header -> cookie list
module Date : sig ... end