summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/Discord/src/http.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/protocols/Discord/src/http.cpp b/protocols/Discord/src/http.cpp
index e9dc031e62..72a6db3915 100644
--- a/protocols/Discord/src/http.cpp
+++ b/protocols/Discord/src/http.cpp
@@ -63,8 +63,8 @@ AsyncHttpRequest::AsyncHttpRequest(CDiscordProto *ppro, int iRequestType, LPCSTR
ptrW text(json_write(pRoot));
pData = mir_utf8encodeW(text);
dataLength = (int)mir_strlen(pData);
- AddHeader("Content-Type", "application/json");
}
+ AddHeader("Content-Type", "application/json");
requestType = iRequestType;
m_pCallback = pFunc;
@@ -85,6 +85,10 @@ AsyncHttpRequest::~AsyncHttpRequest()
void AsyncHttpRequest::AddHeader(LPCSTR szName, LPCSTR szValue)
{
+ for (int i = 0; i < headersCount; i++)
+ if (!mir_strcmp(headers[i].szName, szName))
+ return;
+
headers = (NETLIBHTTPHEADER*)mir_realloc(headers, sizeof(NETLIBHTTPHEADER)*(headersCount + 1));
headers[headersCount].szName = mir_strdup(szName);
headers[headersCount].szValue = mir_strdup(szValue);