From a201d5905ad9188e890eeb0cc0aee8d4fb9dcf3c Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Thu, 20 Aug 2020 03:19:16 -0400 Subject: rudimentary chat --- discord/http.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'discord/http.cpp') diff --git a/discord/http.cpp b/discord/http.cpp index 429a3b2..db41aa4 100644 --- a/discord/http.cpp +++ b/discord/http.cpp @@ -36,6 +36,37 @@ void HTTPClient::MakePOST(std::string path, std::string payload, std::function cb) { + printf("POST %s\n", path.c_str()); + auto url = cpr::Url { m_api_base + path }; + auto headers = cpr::Header { + { "Authorization", m_authorization }, + { "Content-Type", "application/json" }, + }; +#ifdef USE_LOCAL_PROXY + m_futures.push_back(cpr::GetCallback( + std::bind(&HTTPClient::OnResponse, this, std::placeholders::_1, cb), + url, headers, + cpr::Proxies { { "http", "127.0.0.1:8888" }, { "https", "127.0.0.1:8888" } }, + cpr::VerifySsl { false })); +#else + m_futures.push_back(cpr::GetCallback( + std::bind(&HTTPClient::OnResponse, this, std::placeholders::_1, cb), + url, headers)); +#endif } void HTTPClient::CleanupFutures() { -- cgit v1.2.3