#Multipart ClientRequest with streaming bodies

1 messages · Page 1 of 1 (latest)

deft yew
#

I need to create outgoing multipart HTTP requests where some of the parts are streamed (e.g. for uploading a file to box.com).

When I first needed this functionality several years ago, it was not available yet in Vapor, so I rolled my own. But now that I'm converting my code to Swift concurrency, I'm wondering whether it is implemented by now.

sick dragon
#

Latest multipart-kit has a MultipartWriter writer protocol. You could create a type conforming to this that writes to AsyncHTTPClient.

If you want to avoid lots of small writes you can wrap this in a BufferedMultipartWriter which writes to a buffer of a fixed size and when it fills the buffer it writes it out to your own MultipartWriter.

inner torrentBOT