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 2626 cryptokit
2727 re
2828 ocsigen_lib_base
29+ cohttp-lwt
2930 logs
3031 (select
3132 dynlink_wrapper.ml
Original file line number Diff line number Diff line change @@ -239,22 +239,7 @@ let of_lwt_stream stream =
239239 in
240240 make aux
241241
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
258243
259244module StringStream = struct
260245 type out = string t
Original file line number Diff line number Diff line change @@ -106,14 +106,9 @@ val of_file : string -> string t
106106val of_string : string -> string t
107107(* * returns a stream containing a string. *)
108108
109- val of_lwt_stream : 'a Lwt_stream . t -> 'a t
109+ val of_cohttp_body : Cohttp_lwt.Body . t -> string t
110110(* * Convert a {!Lwt_stream.t} to an {!Ocsigen_stream.t}. *)
111111
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-
117112module StringStream : sig
118113 type out = string t
119114 (* * 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 =
365365 match String. lowercase_ascii ct, String. lowercase_ascii cst with
366366 | "application" , "x-www-form-urlencoded" ->
367367 Some
368- (body_gen |> Cohttp_lwt.Body. to_stream |> Ocsigen_stream. of_lwt_stream
368+ (body_gen |> Ocsigen_stream. of_cohttp_body
369369 |> post_params_form_urlencoded)
370370 | "multipart" , "form-data" ->
371371 Some
372- (body_gen |> Cohttp_lwt.Body. to_stream |> Ocsigen_stream. of_lwt_stream
372+ (body_gen |> Ocsigen_stream. of_cohttp_body
373373 |> post_params_multipart_form_data ctparams)
374374 | _ -> None
You can’t perform that action at this time.
0 commit comments