caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Shayne Fletcher <shayne.fletcher.50@gmail.com>
To: Yaron Minsky <yminsky@janestreet.com>
Cc: "Nicolás Ojeda Bär" <nicolas.ojeda.bar@lexifi.com>,
	"caml-list@inria.fr users" <caml-list@inria.fr>
Subject: Re: [Caml-list] [Async / Cohttp_async] Problem getting all of the data in a response body
Date: Thu, 6 Jul 2017 13:20:51 -0400	[thread overview]
Message-ID: <CAMsAzy8rFtPyoi5v0Dnr=G1asW_Yf1U==Z=SxVSEwOXdyR7MTQ@mail.gmail.com> (raw)
In-Reply-To: <CACLX4jTqUOv=6SD8q4MC-+ykbEX=Fk29_geL85XsBw0mdz8kvA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 752 bytes --]

On Thu, Jul 6, 2017 at 1:37 AM, Yaron Minsky <yminsky@janestreet.com> wrote:

> The fact that you're ignoring the result of Pipe.iter is concerning. That
> function should return a deferred that becomes determined once the
> iteration is complete. It's hard to say without having a bit more of the
> program, but I suspect the bug is related to that.
>

The following fragment seems to do the trick.

```
     fun () : unit Deferred.Or_error.t ->
       Async_client.post ... uri >>= fun (_, body) ->
       Async.Pipe.iter
         ~continue_on_error:true
         ~f:(fun s -> Deferred.return (printf "%s" s))
         (Cohttp_async.Body.to_pipe body) >>| fun () ->
       Ok ()
```​
​Thanks again.​

-- 
Shayne Fletcher

[-- Attachment #2: Type: text/html, Size: 1761 bytes --]

      parent reply	other threads:[~2017-07-06 17:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-05 22:55 Shayne Fletcher
2017-07-06  5:23 ` Nicolás Ojeda Bär
2017-07-06  5:37   ` Yaron Minsky
2017-07-06  6:51     ` Shayne Fletcher
2017-07-06 17:20     ` Shayne Fletcher [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMsAzy8rFtPyoi5v0Dnr=G1asW_Yf1U==Z=SxVSEwOXdyR7MTQ@mail.gmail.com' \
    --to=shayne.fletcher.50@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=nicolas.ojeda.bar@lexifi.com \
    --cc=yminsky@janestreet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).