mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-03 22:36:23 +00:00
start fixing backend heartbeat
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "Common.h"
|
||||
#include "CustomAssert.h"
|
||||
#include "LuaAPI.h"
|
||||
#include "httplib.h"
|
||||
|
||||
#include <map>
|
||||
#include <random>
|
||||
@@ -33,8 +34,9 @@ std::string Http::GET(const std::string& host, int port, const std::string& targ
|
||||
}
|
||||
}
|
||||
|
||||
std::string Http::POST(const std::string& host, int port, const std::string& target, const std::string& body, const std::string& ContentType, unsigned int* status) {
|
||||
std::string Http::POST(const std::string& host, int port, const std::string& target, const std::string& body, const std::string& ContentType, unsigned int* status, const httplib::Headers& headers) {
|
||||
httplib::SSLClient client(host, port);
|
||||
beammp_assert(client.is_valid());
|
||||
client.enable_server_certificate_verification(false);
|
||||
client.set_address_family(AF_INET);
|
||||
auto res = client.Post(target.c_str(), body.c_str(), body.size(), ContentType.c_str());
|
||||
@@ -44,6 +46,7 @@ std::string Http::POST(const std::string& host, int port, const std::string& tar
|
||||
}
|
||||
return res->body;
|
||||
} else {
|
||||
beammp_debug("POST failed: " + httplib::to_string(res.error()));
|
||||
return Http::ErrorString;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user