This commit is contained in:
j842
2025-05-26 13:31:56 +12:00
parent ad4d0ddfda
commit d0b9d80445
4 changed files with 57 additions and 0 deletions

20
test/main.cpp Normal file
View File

@ -0,0 +1,20 @@
#include <iostream>
#include <httplib.h>
#include <nlohmann/json.hpp>
#include <libassert/assert.hpp>
int main() {
httplib::Client cli("https://ipinfo.io");
auto res = cli.Get("/ip");
ASSERT(res->status == 200, "Failed to get IP");
nlohmann::json j;
j["ip"] = res->body;
j["status"] = res->status;
std::cout << j.dump(4) << std::endl;
return 0;
}