How can I post FileInfo to a web service using Yesod and Http-Conduit?

风格不统一 提交于 2019-12-05 17:27:04

I think your guess about chunked request body is correct. What you need to do is:

  • Stream the uploaded contents into a temporary file.
  • Get the size of that file.
  • Use requestBodySource and provide the file length and its contents.

Fortunately, steps (1) and (2) can be handled quite easily by the sinkCacheLength function. You'll end up with something like:

(fSize, fSource) <- fileSource fi $$ sinkCacheLength
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!