From f5ae8c3d3fd4c6b928da6c7c3c785525fc60b7b4 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Mon, 12 Oct 2020 18:17:53 -0400 Subject: add kick/ban --- discord/http.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'discord/http.cpp') diff --git a/discord/http.cpp b/discord/http.cpp index 4c9cf87..41f6c17 100644 --- a/discord/http.cpp +++ b/discord/http.cpp @@ -71,6 +71,27 @@ void HTTPClient::MakePOST(std::string path, std::string payload, std::function cb) { + printf("PUT %s\n", path.c_str()); + auto url = cpr::Url { m_api_base + path }; + auto headers = cpr::Header { + { "Authorization", m_authorization }, + { "Content-Type", "application/json" }, + }; + auto body = cpr::Body { payload }; +#ifdef USE_LOCAL_PROXY + m_futures.push_back(cpr::PutCallback( + std::bind(&HTTPClient::OnResponse, this, std::placeholders::_1, cb), + url, headers, body, + cpr::Proxies { { "http", "127.0.0.1:8888" }, { "https", "127.0.0.1:8888" } }, + cpr::VerifySsl { false })); +#else + m_futures.push_back(cpr::PutCallback( + std::bind(&HTTPClient::OnResponse, this, std::placeholders::_1, cb), + url, headers, body)); +#endif +} + void HTTPClient::MakeGET(std::string path, std::function cb) { printf("GET %s\n", path.c_str()); auto url = cpr::Url { m_api_base + path }; -- cgit v1.2.3