@@ -552,6 +552,48 @@ module Method : sig
552552 val of_string : string -> t
553553end
554554
555+ (* * Module to handle cookies *)
556+ module Cookies : sig
557+ (* * {1 Cookies}
558+
559+ Cookies are data that are maintend both on server and clients.
560+ This is a module to get and set cookies in the headers. *)
561+
562+ type same_site = None | Lax | Strict
563+ type cookie = {
564+ name : string ;
565+ value : string ;
566+ path : string option ;
567+ domain : string option ;
568+ expires : Unix .tm option ;
569+ max_age : int64 option ;
570+ secure : bool ;
571+ http_only : bool ;
572+ same_site : same_site ;
573+ extension : string option ;
574+ }
575+
576+ type t = cookie list
577+
578+ val empty : t
579+ val parse : string -> t
580+ val add : cookie -> t -> t
581+ val create : ?path : string ->
582+ ?domain : string ->
583+ ?expires : Unix .tm ->
584+ ?max_age : int64 ->
585+ ?secure : bool ->
586+ ?http_only : bool ->
587+ ?same_site : same_site ->
588+ ?extension : string ->
589+ name :string ->
590+ string -> t -> t
591+ val value : cookie -> string
592+ val name : cookie -> string
593+
594+ val get : string -> t -> Cookies .cookie
595+ end
596+
555597(* * Module to handle request and response headers *)
556598module Headers : sig
557599 (* * {1 Headers}
@@ -600,48 +642,6 @@ module Headers : sig
600642 (* * Pretty print the headers. *)
601643end
602644
603- (* * Module to handle cookies *)
604- module Cookies : sig
605- (* * {1 Cookies}
606-
607- Cookies are data that are maintend both on server and clients.
608- This is a module to get and set cookies in the headers. *)
609-
610- type same_site = None | Lax | Strict
611- type cookie = {
612- name : string ;
613- value : string ;
614- path : string option ;
615- domain : string option ;
616- expires : Unix .tm option ;
617- max_age : int64 option ;
618- secure : bool ;
619- http_only : bool ;
620- same_site : same_site ;
621- extension : string option ;
622- }
623-
624- type t = cookie list
625-
626- val empty : t
627- val parse : string -> t
628- val add : cookie -> t -> t
629- val create : ?path : string ->
630- ?domain : string ->
631- ?expires : Unix .tm ->
632- ?max_age : int64 ->
633- ?secure : bool ->
634- ?http_only : bool ->
635- ?same_site : same_site ->
636- ?extension : string ->
637- name :string ->
638- string -> t -> t
639- val value : cookie -> string
640- val name : cookie -> string
641-
642- val get : string -> t -> Cookies .cookie
643- end
644-
645645(* * Module handling HTML requests *)
646646module Request : sig
647647 (* * {1 Requests}
0 commit comments