File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
module Body = struct
2
2
type t = ((string -> unit Lwt .t ) -> unit Lwt .t ) * Cohttp.Transfer .encoding
3
3
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)
6
11
7
12
let of_cohttp body =
8
13
( (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
4
4
type t
5
5
6
6
val empty : t
7
+ val of_string : string -> t
7
8
8
9
val make :
9
10
Cohttp.Transfer .encoding
@@ -47,9 +48,11 @@ val of_cohttp :
47
48
val to_response_expert :
48
49
t
49
50
-> 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. *)
51
52
52
53
val response : t -> Cohttp.Response .t
54
+ (* * Raw response without cookie headers set. *)
55
+
53
56
val body : t -> Body .t
54
57
val status : t -> Cohttp.Code .status
55
58
val set_status : t -> Cohttp.Code .status -> t
You can’t perform that action at this time.
0 commit comments