Add libhv and test http client

This commit is contained in:
Guilherme Werner
2023-12-03 16:38:19 -03:00
parent 7297e2e383
commit 4fb0abd834
102 changed files with 60661 additions and 26 deletions

View File

@ -8,9 +8,39 @@ namespace tribufu
{
this->id = id;
this->secret = secret;
this->http = hv::HttpClient();
}
TribufuClient::~TribufuClient()
{
}
void TribufuClient::get_token()
{
try
{
const char *base_url = "http://localhost:5000";
HttpRequest req;
req.SetMethod("POST");
req.SetUrl(base_url);
HttpResponse resp;
int ret = this->http.send(&req, &resp);
if (ret != 0)
{
std::cout << "request_failed" << std::endl;
}
else
{
std::cout << "request_success" << std::endl;
}
}
catch (std::exception &e)
{
std::cout << "exception" << e.what() << std::endl;
}
}
}