quick commit

This commit is contained in:
2026-02-04 15:52:31 +01:00
parent 0463c37543
commit ce0643b6ac
26 changed files with 929 additions and 45 deletions

View File

@@ -0,0 +1,36 @@
#pragma once
#include <map>
#include <string>
struct HttpResponse {
long status_code = 0;
std::string body;
std::map<std::string, std::string> headers;
std::string error;
bool ok() const {
return error.empty();
}
};
class HttpConnection {
public:
static HttpResponse get(const std::string &url,
const std::map<std::string, std::string> &headers = {},
long timeout_ms = 0);
static HttpResponse post(const std::string &url,
const std::string &body,
const std::map<std::string, std::string> &headers = {},
const std::string &content_type = "application/json",
long timeout_ms = 0);
private:
static HttpResponse performRequest(const std::string &method,
const std::string &url,
const std::string &body,
const std::map<std::string, std::string> &headers,
const std::string &content_type,
long timeout_ms);
};