summaryrefslogtreecommitdiff
path: root/discord/http.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2020-08-30 01:59:14 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2020-08-30 01:59:14 -0400
commitfbd8ed2ba74ee514e2355bf0d456f89c3f598388 (patch)
treef13f39a3d321d4ae215a85794267d3f36c0d87e6 /discord/http.cpp
parent08e9d2f0efa0f90b27b1aefe4d319296964dcfdb (diff)
downloadabaddon-portaudio-fbd8ed2ba74ee514e2355bf0d456f89c3f598388.tar.gz
abaddon-portaudio-fbd8ed2ba74ee514e2355bf0d456f89c3f598388.zip
add HTTPClient::MakeDELETE
Diffstat (limited to 'discord/http.cpp')
-rw-r--r--discord/http.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/discord/http.cpp b/discord/http.cpp
index d08fefe..454324e 100644
--- a/discord/http.cpp
+++ b/discord/http.cpp
@@ -7,6 +7,26 @@ void HTTPClient::SetAuth(std::string auth) {
m_authorization = auth;
}
+void HTTPClient::MakeDELETE(std::string path, std::function<void(cpr::Response r)> cb) {
+ printf("DELETE %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::DeleteCallback(
+ std::bind(&HTTPClient::OnResponse, this, std::placeholders::_1, cb),
+ url, headers));
+#endif
+}
+
void HTTPClient::MakePATCH(std::string path, std::string payload, std::function<void(cpr::Response r)> cb) {
printf("PATCH %s\n", path.c_str());
auto url = cpr::Url { m_api_base + path };