Skip to content

Commit

Permalink
push: Always use POST (regardless of body presence)
Browse files Browse the repository at this point in the history
Fixes: #469
  • Loading branch information
gjasny committed Mar 21, 2021
1 parent 2412990 commit 5fc8fb9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions push/src/gateway.cc
Expand Up @@ -94,11 +94,10 @@ int Gateway::performHttpRequest(HttpMethod method, const std::string& uri,
curl_easy_setopt(curl, CURLOPT_URL, uri.c_str());

curl_slist* header_chunk = nullptr;
header_chunk = curl_slist_append(header_chunk, CONTENT_TYPE);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header_chunk);

if (!body.empty()) {
header_chunk = curl_slist_append(header_chunk, CONTENT_TYPE);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header_chunk);

curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, body.size());
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.data());
}
Expand All @@ -110,8 +109,7 @@ int Gateway::performHttpRequest(HttpMethod method, const std::string& uri,

switch (method) {
case HttpMethod::Post:
curl_easy_setopt(curl, CURLOPT_HTTPGET, 0L);
curl_easy_setopt(curl, CURLOPT_NOBODY, 0L);
curl_easy_setopt(curl, CURLOPT_POST, 1L);
break;

case HttpMethod::Put:
Expand Down

0 comments on commit 5fc8fb9

Please sign in to comment.