I am doing a multi-part file upload using clj-http. I am wondering if there is a way I can track the progress of a file upload. Perhaps, some function that gets called periodically with how much of the file has been uploaded so far?
1 Answers
clj-http uses Apache HTTP Client underneath so you can reuse a solution presented in the answer to another question. However, it cannot be easily.
The code presented in the linked answer provides an enhanced implementation of HttpEntity
. clj-http currently doesn't support providing your own instance of HttpEntity
as your request body.
You have two options:
Provide a pull request to clj-http so it supports providing an instance of
HttpEntity
as the:body
value (e.g. by adding anothercond
branch checking forHttpEntity
value or by makingwrap-input-coercion
a multimethod so you can extend it forHttpEntity
).Provide similar logic to that from the mentioned
FileEntity
andOutputStreamProgress
but in your implementation oforg.apache.http.entity.mime.content.ContentBody
. clj-http supports providing them as values for multipart attachments. The drawback here is that it would track progress per attachment, not per the whole request.

- 1
- 1

- 12,965
- 1
- 31
- 49