tests: add httpcommon tests and add new file_handler methods (#2712)

Co-authored-by: Mariotaku <mariotaku.lee@gmail.com>
This commit is contained in:
ReenigneArcher
2024-06-17 14:03:42 -04:00
committed by GitHub
parent 0c0b4c4610
commit 334267807f
8 changed files with 144 additions and 6 deletions

View File

@@ -200,6 +200,14 @@ namespace http {
BOOST_LOG(error) << "Couldn't create CURL instance";
return false;
}
std::string file_dir = file_handler::get_parent_directory(file);
if (!file_handler::make_directory(file_dir)) {
BOOST_LOG(error) << "Couldn't create directory ["sv << file_dir << ']';
curl_easy_cleanup(curl);
return false;
}
FILE *fp = fopen(file.c_str(), "wb");
if (!fp) {
BOOST_LOG(error) << "Couldn't open ["sv << file << ']';