-
-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Have a streaming request body for servant-client #886
Comments
@nmattia Something like this (and we have a server interpretation for this as well) ? Note that this points to the 'latest' branch of the docs, which reflects the state of master, this streaming stuffs has not been released yet, it will be part of the next one. One little note: the Also, regarding a client interpretation for multipart, someone's interesting in working on this and I described a possible way to tackle this in here. |
Not sure, I didn't look at it in much detail but it seems it be related to server responses, whereas I'm looking for a streaming
Right, I posted my implementation in there. As mentioned in my first message here, the unfortunate trade-off is loading the file in memory vs. lazy I/O (I went with the former here). |
Oh right, we don't have a streaming request body thing there, I thought we did for a second sorry. Regarding your implementation, that's a really great start, but the choice between in-memory vs lazy I/O is not one I'm really willing to make. But indeed the proper solution is to just add a constructor to represent "files to be sent" or maybe something a little more general, in |
Anyone understand the point of |
Related: #656, time have past though, so doing that exercise again is not straight forward. @jkarni i `> Allows creation of a RequestBody inside the IO monad, which is useful for making easier APIs (like setRequestBodyFile interesting part is RequestBodyStream Int64 ( (IO ByteString -> IO ()) -> IO ()) -- GivesPopper () When you look at that long enough, you see that's it's used as case body of
RequestBodyStream _len givespopper = givespopper writer where
writer :: IO ByteString -> IO ()
writer popper = do
bs <- popper
if BS.null bs
then weAreDone
else writeBs bs >> writer popper ... and the |
Currently, the request body may only be a lazy bytestring. This is a problem when large files must be included in the body, as the file must either be loaded fully in memory, or one has to use lazy I/O. It would be nice to have something similar to
http-client
's request body. I understand that it's not doable for servant-client-core to depend on http-client; however there may be a way to extract some types from http-client, which would also make the multipart implementation ( #884 ) simpler.CC @jkarni @alpmestan
The text was updated successfully, but these errors were encountered: