diff options
author | tastytea | 2020-01-10 14:33:33 +0100 |
---|---|---|
committer | tastytea | 2020-01-10 14:33:33 +0100 |
commit | cb7019a0fdc1ee861a5a2ab65d49845d7b194bb8 (patch) | |
tree | bd07f45b7cac868b7da498b11ec4089056e44add /src | |
parent | 108aeea771b350db33627139130f9bdaf90033c1 (diff) | |
download | mastodonpp-cb7019a0fdc1ee861a5a2ab65d49845d7b194bb8.tar mastodonpp-cb7019a0fdc1ee861a5a2ab65d49845d7b194bb8.tar.gz mastodonpp-cb7019a0fdc1ee861a5a2ab65d49845d7b194bb8.zip |
Allow HTTP POST without parameters.
Diffstat (limited to 'src')
-rw-r--r-- | src/curl_wrapper.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/curl_wrapper.cpp b/src/curl_wrapper.cpp index d7e152f..b4ba74e 100644 --- a/src/curl_wrapper.cpp +++ b/src/curl_wrapper.cpp @@ -101,10 +101,17 @@ answer_type CURLWrapper::make_request(const http_method &method, string uri, } case http_method::POST: { - curl_mime *mime{parameters_to_curl_mime(uri, parameters)}; - - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) - code = curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime); + if (parameters.empty()) + { + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) + code = curl_easy_setopt(_connection, CURLOPT_POST, 1L); + } + else + { + curl_mime *mime{parameters_to_curl_mime(uri, parameters)}; + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) + code = curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime); + } break; } |