File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 11module Body = struct
22 type t = ((string -> unit Lwt .t ) -> unit Lwt .t ) * Cohttp.Transfer .encoding
33
4- let empty : t = (fun _write -> Lwt. return_unit), Fixed 0L
5- let make encoding writer = writer, encoding
4+ let make encoding writer : t = writer, encoding
5+ let empty = make (Fixed 0L ) (fun _write -> Lwt. return_unit)
6+
7+ let of_string s =
8+ make
9+ (Cohttp.Transfer. Fixed (Int64. of_int (String. length s)))
10+ (fun write -> write s)
611
712 let of_cohttp body =
813 ( (fun write -> Cohttp_lwt.Body. write_body write body)
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ module Body : sig
44 type t
55
66 val empty : t
7+ val of_string : string -> t
78
89 val make :
910 Cohttp.Transfer .encoding
@@ -47,9 +48,11 @@ val of_cohttp :
4748val to_response_expert :
4849 t
4950 -> Cohttp.Response .t * ('ic -> Lwt_io .output_channel -> unit Lwt .t )
50- (* * Response for [Cohttp_lwt_unix.Server.make_expert]. *)
51+ (* * Response for [Cohttp_lwt_unix.Server.make_expert]. Set cookie headers. *)
5152
5253val response : t -> Cohttp.Response .t
54+ (* * Raw response without cookie headers set. *)
55+
5356val body : t -> Body .t
5457val status : t -> Cohttp.Code .status
5558val set_status : t -> Cohttp.Code .status -> t
You can’t perform that action at this time.
0 commit comments