drogon
drogon copied to clipboard
Downloading of files from file response in HttpClient
Hello,
I'm writing an application including both server and client based on Drogon. Among all use cases there is one when the client uploads files to the server and another when the client downloads files from server.
And here comes the problem, because there are no documentation and good examples of file transmission, especially for HttpClient.
The part of uploading files to server could still be achieved as I found some files in the Drogon repository which helped me:
- for server:
- from examples: https://github.com/drogonframework/drogon/blob/master/examples/file_upload/file_upload.cc
- from integration tests: https://github.com/drogonframework/drogon/blob/master/lib/tests/integration_test/server/api_Attachment.cc
- for client:
- from integration tests: https://github.com/drogonframework/drogon/blob/master/lib/tests/integration_test/client/main.cc#L696-L729
However I found no explanation how to download files by the client. All I found until now is:
- for server:
- from integration tests: https://github.com/drogonframework/drogon/blob/master/lib/tests/integration_test/server/api_Attachment.cc#L106-L112
- for client:
- from integration tests: https://github.com/drogonframework/drogon/blob/master/lib/tests/integration_test/client/main.cc#L661-L670
So the example from server integration tests is quite useful, because everything needed is there. But the example from client integration test is useless, because the file send in file response is not downloaded at all.
I think it's not good that you have to search for examples of usage of basic functionalities of the software in integration tests and the rest of source code. There are Wiki and examples directory, 2 ideal places to put some short functional examples for it 🙂
To sum up, my requests are:
- Is it possible to add functional examples of files uploading and downloading for client placed in the repo in examples directory?
- Is it possible to add a documentation (in Wiki) of file transmission regarding both sides, server and client?
- Can anyone share the implementation of downloading files on client side?
Thanks for your feedback. This is something I completely agree with. We’ll keep this on the radar.