Don't check errors if it can't fail.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2020-01-11 18:06:06 +01:00
parent d749e3aa23
commit 597cf41668
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 19 additions and 13 deletions

View File

@ -86,10 +86,9 @@ answer_type CURLWrapper::make_request(const http_method &method, string uri,
{
case http_method::GET:
{
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
code = curl_easy_setopt(_connection, CURLOPT_HTTPGET, 1L);
add_parameters_to_uri(uri, parameters);
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
curl_easy_setopt(_connection, CURLOPT_HTTPGET, 1L);
break;
}
@ -98,13 +97,13 @@ answer_type CURLWrapper::make_request(const http_method &method, string uri,
if (parameters.empty())
{
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
code = curl_easy_setopt(_connection, CURLOPT_POST, 1L);
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);
curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime);
}
break;
@ -115,11 +114,15 @@ answer_type CURLWrapper::make_request(const http_method &method, string uri,
{
curl_mime *mime{parameters_to_curl_mime(uri, parameters)};
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
code = curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime);
curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime);
}
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST, "PATCH");
if (code != CURLE_OK)
{
throw CURLException{code, "Failed to set URI", _curl_buffer_error};
}
break;
}
@ -129,11 +132,15 @@ answer_type CURLWrapper::make_request(const http_method &method, string uri,
{
curl_mime *mime{parameters_to_curl_mime(uri, parameters)};
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
code = curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime);
curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime);
}
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST, "PUT");
if (code != CURLE_OK)
{
throw CURLException{code, "Failed to set URI", _curl_buffer_error};
}
break;
}
@ -143,20 +150,19 @@ answer_type CURLWrapper::make_request(const http_method &method, string uri,
{
curl_mime *mime{parameters_to_curl_mime(uri, parameters)};
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
code = curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime);
curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime);
}
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST, "DELETE");
if (code != CURLE_OK)
{
throw CURLException{code, "Failed to set URI", _curl_buffer_error};
}
break;
}
}
if (code != CURLE_OK)
{
throw CURLException{code, "Failed to set HTTP method",
_curl_buffer_error};
}
debuglog << "Making request to: " << uri << '\n';
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)