(http client) rework a bit PATCH pull request, fix compile error with setForceBody and initialize _forceBody to false

This commit is contained in:
Benjamin Sergeant
2020-05-05 07:43:55 -07:00
parent 8760c87635
commit 15355188d5
2 changed files with 27 additions and 2 deletions

View File

@ -30,6 +30,7 @@ namespace ix
HttpClient::HttpClient(bool async)
: _async(async)
, _stop(false)
, _forceBody(false)
{
if (!_async) return;
@ -50,9 +51,11 @@ namespace ix
_tlsOptions = tlsOptions;
}
void setForceBody(bool value) {
void HttpClient::setForceBody(bool value)
{
_forceBody = value;
}
HttpRequestArgsPtr HttpClient::createRequest(const std::string& url, const std::string& verb)
{
auto request = std::make_shared<HttpRequestArgs>();
@ -564,6 +567,20 @@ namespace ix
return request(url, kPut, body, args);
}
HttpResponsePtr HttpClient::patch(const std::string& url,
const HttpParameters& httpParameters,
HttpRequestArgsPtr args)
{
return request(url, kPatch, serializeHttpParameters(httpParameters), args);
}
HttpResponsePtr HttpClient::patch(const std::string& url,
const std::string& body,
const HttpRequestArgsPtr args)
{
return request(url, kPatch, body, args);
}
std::string HttpClient::urlEncode(const std::string& value)
{
std::ostringstream escaped;