add httpGet error handling

This commit is contained in:
MihailRis
2024-11-11 14:47:09 +03:00
parent d7389c2220
commit 4328c83c79
3 changed files with 36 additions and 11 deletions
+6 -3
View File
@@ -9,9 +9,12 @@ TEST(curltest, curltest) {
network->httpGet(
"https://raw.githubusercontent.com/MihailRis/VoxelEngine-Cpp/refs/"
"heads/curl/res/content/base/blocks/lamp.json",
[=](int code, std::vector<char> data) {
auto v = std::string_view(data.data(), data.size());
auto value = json::parse(v);
[](std::vector<char> data) {
if (data.empty()) {
return;
}
auto view = std::string_view(data.data(), data.size());
auto value = json::parse(view);
std::cout << value << std::endl;
}
);