Module Http.Cookie

Cookies.

Support for cookies.

type name = string

The type for cookie names.

type attributes

The type for cookie attributes.

val default_attributes : attributes

default_attributes are cookie attributes with secure set to true, http_only set to true, same_site set to "strict" and no other attribute specified.

val attributes : ?init:attributes -> ?domain:string option -> ?http_only:bool -> ?max_age:int option -> ?path:Path.t -> ?same_site:string -> ?secure:bool -> unit -> attributes

atts () are the given cookie attributes. Those unspecified take the value of init which defaults to default_attributes.

Converting

val encode : ?attributes:attributes -> name:name -> string -> string

encodes ~atts name value encodes a cookie named name with value value and attributes atts (defaults to default_attributes) for Headers.add_set_cookie.

val decode_list : string -> ((name * string) list, string) Stdlib.result

decode_list s parses the cookie string of a Headers.cookie header value.