first commit
This commit is contained in:
commit
7349b743e3
21 files changed
+1527
No files matched your search
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
struct HttpResponse {
|
||||
long status = 0;
|
||||
std::string body;
|
||||
bool ok() const { return status >= 200 && status < 300; }
|
||||
};
|
||||
|
||||
// Minimal libcurl wrapper used for both scraping (GET) and talking to the
|
||||
// Discord REST API / webhooks (POST json). Kept tiny and dependency-light
|
||||
// rather than reusing a full framework.
|
||||
class HttpClient {
|
||||
public:
|
||||
static void globalInit(); // call once at process start
|
||||
static void globalCleanup();
|
||||
|
||||
static HttpResponse get(const std::string& url,
|
||||
const std::map<std::string, std::string>& headers = {},
|
||||
long timeout_seconds = 30);
|
||||
|
||||
static HttpResponse postJson(const std::string& url,
|
||||
const std::string& json_body,
|
||||
const std::map<std::string, std::string>& headers = {},
|
||||
long timeout_seconds = 15);
|
||||
};
|
||||
Reference in new issue
Block a user