.
This commit is contained in:
20
test/main.cpp
Normal file
20
test/main.cpp
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user