Refine the streaming, add UT, add error handling.

This commit is contained in:
Chunting Gu
2019-08-09 16:10:16 +08:00
parent c669551552
commit feae9b7acc
17 changed files with 316 additions and 212 deletions
+5 -5
View File
@@ -21,8 +21,8 @@ int main(int argc, char* argv[]) {
return 1;
}
std::string url = argv[1];
std::string path = argv[2];
const char* url = argv[1];
const char* path = argv[2];
WEBCC_LOG_INIT("", webcc::LOG_CONSOLE);
@@ -32,9 +32,9 @@ int main(int argc, char* argv[]) {
auto r = session.Request(webcc::RequestBuilder{}.Get(url)(),
true); // Stream the response data to file.
auto file_body = r->file_body();
file_body->Move(path);
if (auto file_body = r->file_body()) {
file_body->Move(path);
}
} catch (const std::exception& e) {
std::cerr << e.what() << std::endl;