File tree Expand file tree Collapse file tree 4 files changed +5
-24
lines changed Expand file tree Collapse file tree 4 files changed +5
-24
lines changed Original file line number Diff line number Diff line change 26
26
cryptokit
27
27
re
28
28
ocsigen_lib_base
29
+ cohttp-lwt
29
30
logs
30
31
(select
31
32
dynlink_wrapper.ml
Original file line number Diff line number Diff line change @@ -239,22 +239,7 @@ let of_lwt_stream stream =
239
239
in
240
240
make aux
241
241
242
- (* * Convert an {!Ocsigen_stream.t} into a {!Lwt_stream.t}.
243
- @param is_empty function to skip empty chunk.
244
- *)
245
- let to_lwt_stream ?(is_empty = fun _ -> false ) o_stream =
246
- let stream = ref (get o_stream) in
247
- let rec wrap () =
248
- next ! stream >> = function
249
- | Finished None -> o_stream.finalizer `Success >> = fun () -> Lwt. return None
250
- | Finished (Some next ) ->
251
- stream := next;
252
- wrap ()
253
- | Cont (value , next ) ->
254
- stream := next;
255
- if is_empty value then wrap () else Lwt. return (Some value)
256
- in
257
- Lwt_stream. from wrap
242
+ let of_cohttp_body body = Cohttp_lwt.Body. to_stream body |> of_lwt_stream
258
243
259
244
module StringStream = struct
260
245
type out = string t
Original file line number Diff line number Diff line change @@ -106,14 +106,9 @@ val of_file : string -> string t
106
106
val of_string : string -> string t
107
107
(* * returns a stream containing a string. *)
108
108
109
- val of_lwt_stream : 'a Lwt_stream . t -> 'a t
109
+ val of_cohttp_body : Cohttp_lwt.Body . t -> string t
110
110
(* * Convert a {!Lwt_stream.t} to an {!Ocsigen_stream.t}. *)
111
111
112
- val to_lwt_stream : ?is_empty : ('a -> bool ) -> 'a t -> 'a Lwt_stream .t
113
- (* * Convert an {!Ocsigen_stream.t} into a {!Lwt_stream.t}.
114
- @param is_empty function to skip empty chunk.
115
- *)
116
-
117
112
module StringStream : sig
118
113
type out = string t
119
114
(* * Interface for stream creation (for tyxml) *)
Original file line number Diff line number Diff line change @@ -365,10 +365,10 @@ let post_params ~content_type body_gen =
365
365
match String. lowercase_ascii ct, String. lowercase_ascii cst with
366
366
| "application" , "x-www-form-urlencoded" ->
367
367
Some
368
- (body_gen |> Cohttp_lwt.Body. to_stream |> Ocsigen_stream. of_lwt_stream
368
+ (body_gen |> Ocsigen_stream. of_cohttp_body
369
369
|> post_params_form_urlencoded)
370
370
| "multipart" , "form-data" ->
371
371
Some
372
- (body_gen |> Cohttp_lwt.Body. to_stream |> Ocsigen_stream. of_lwt_stream
372
+ (body_gen |> Ocsigen_stream. of_cohttp_body
373
373
|> post_params_multipart_form_data ctparams)
374
374
| _ -> None
You can’t perform that action at this time.
0 commit comments