Don't check errors if it can't fail.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
d749e3aa23
commit
597cf41668
|
@ -86,10 +86,9 @@ answer_type CURLWrapper::make_request(const http_method &method, string uri,
|
||||||
{
|
{
|
||||||
case http_method::GET:
|
case http_method::GET:
|
||||||
{
|
{
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
|
||||||
code = curl_easy_setopt(_connection, CURLOPT_HTTPGET, 1L);
|
|
||||||
|
|
||||||
add_parameters_to_uri(uri, parameters);
|
add_parameters_to_uri(uri, parameters);
|
||||||
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
||||||
|
curl_easy_setopt(_connection, CURLOPT_HTTPGET, 1L);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -98,13 +97,13 @@ answer_type CURLWrapper::make_request(const http_method &method, string uri,
|
||||||
if (parameters.empty())
|
if (parameters.empty())
|
||||||
{
|
{
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
||||||
code = curl_easy_setopt(_connection, CURLOPT_POST, 1L);
|
curl_easy_setopt(_connection, CURLOPT_POST, 1L);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
curl_mime *mime{parameters_to_curl_mime(uri, parameters)};
|
curl_mime *mime{parameters_to_curl_mime(uri, parameters)};
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
||||||
code = curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime);
|
curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
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)};
|
curl_mime *mime{parameters_to_curl_mime(uri, parameters)};
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
// 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)
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
||||||
code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST, "PATCH");
|
code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST, "PATCH");
|
||||||
|
if (code != CURLE_OK)
|
||||||
|
{
|
||||||
|
throw CURLException{code, "Failed to set URI", _curl_buffer_error};
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
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)};
|
curl_mime *mime{parameters_to_curl_mime(uri, parameters)};
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
// 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)
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
||||||
code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST, "PUT");
|
code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST, "PUT");
|
||||||
|
if (code != CURLE_OK)
|
||||||
|
{
|
||||||
|
throw CURLException{code, "Failed to set URI", _curl_buffer_error};
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
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)};
|
curl_mime *mime{parameters_to_curl_mime(uri, parameters)};
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
// 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)
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
||||||
code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST, "DELETE");
|
code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST, "DELETE");
|
||||||
|
if (code != CURLE_OK)
|
||||||
|
{
|
||||||
|
throw CURLException{code, "Failed to set URI", _curl_buffer_error};
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (code != CURLE_OK)
|
|
||||||
{
|
|
||||||
throw CURLException{code, "Failed to set HTTP method",
|
|
||||||
_curl_buffer_error};
|
|
||||||
}
|
|
||||||
debuglog << "Making request to: " << uri << '\n';
|
debuglog << "Making request to: " << uri << '\n';
|
||||||
|
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user