Skip to content

Commit

Permalink
eio(client) : fix mirage#930
Browse files Browse the repository at this point in the history
  • Loading branch information
bikallem committed Sep 2, 2022
1 parent 42a25c5 commit eecef68
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions cohttp-eio/src/client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,9 @@ let patch ?version ?headers ?body ~conn host resource_path =
(* Response Body *)

let read_fixed ((response, reader) : Http.Response.t * Buf_read.t) =
match
Http.Header.get response.headers "Content-Length"
|> Option.get
|> int_of_string
with
| content_length -> Buf_read.take content_length reader
| exception _ -> Buf_read.take_all reader
match Http.Response.content_length response with
| Some content_length -> Buf_read.take content_length reader
| None -> Buf_read.take_all reader

let read_chunked : response -> (Body.chunk -> unit) -> Http.Header.t option =
fun (response, reader) f -> Body.read_chunked reader response.headers f

0 comments on commit eecef68

Please sign in to comment.