add Network.httpGet (WIP)

This commit is contained in:
MihailRis
2024-11-11 03:50:00 +03:00
parent a5d87c9fc4
commit 46dfdac998
5 changed files with 113 additions and 18 deletions
+18
View File
@@ -0,0 +1,18 @@
#include <gtest/gtest.h>
#include "network/Network.hpp"
#include "coders/json.hpp"
TEST(curltest, curltest) {
NetworkSettings settings {};
auto network = network::Network::create(settings);
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::cout << value << std::endl;
}
);
}