mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-25 16:23:46 +02:00
emplace HTTP post data by reference
This commit is contained in:
parent
88d8c9d63c
commit
75e35f13e8
1 changed files with 6 additions and 6 deletions
|
@ -118,7 +118,7 @@ HTTPResponse HTTPRequest::get() {
|
||||||
// Seems to need to be disabled for now, at least on macOS
|
// Seems to need to be disabled for now, at least on macOS
|
||||||
client.enable_server_certificate_verification(false);
|
client.enable_server_certificate_verification(false);
|
||||||
|
|
||||||
for (auto h : _headers)
|
for (auto const h : _headers)
|
||||||
head.emplace(h.first, h.second);
|
head.emplace(h.first, h.second);
|
||||||
|
|
||||||
if (auto result = client.Get(getPath(target).c_str(), head)) {
|
if (auto result = client.Get(getPath(target).c_str(), head)) {
|
||||||
|
@ -126,7 +126,7 @@ HTTPResponse HTTPRequest::get() {
|
||||||
ret._status = response.status;
|
ret._status = response.status;
|
||||||
ret._body = response.body;
|
ret._body = response.body;
|
||||||
|
|
||||||
for (auto h : response.headers)
|
for (auto const h : response.headers)
|
||||||
ret._headers.emplace(h.first, h.second);
|
ret._headers.emplace(h.first, h.second);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -148,10 +148,10 @@ HTTPResponse HTTPRequest::post(StringMap &postData) {
|
||||||
// Seems to need to be disabled for now, at least on macOS
|
// Seems to need to be disabled for now, at least on macOS
|
||||||
client.enable_server_certificate_verification(false);
|
client.enable_server_certificate_verification(false);
|
||||||
|
|
||||||
for (auto h : _headers)
|
for (auto const h : _headers)
|
||||||
head.emplace(h.first, h.second);
|
head.emplace(h.first, h.second);
|
||||||
|
|
||||||
for (auto p : postData)
|
for (auto const &p : postData)
|
||||||
params.emplace(p.first, p.second);
|
params.emplace(p.first, p.second);
|
||||||
|
|
||||||
if (auto result = client.Post(getPath(target).c_str(), head, params)) {
|
if (auto result = client.Post(getPath(target).c_str(), head, params)) {
|
||||||
|
@ -179,7 +179,7 @@ HTTPResponse HTTPRequest::post(const char *body, const char *content_type) {
|
||||||
// Seems to need to be disabled for now, at least on macOS
|
// Seems to need to be disabled for now, at least on macOS
|
||||||
client.enable_server_certificate_verification(false);
|
client.enable_server_certificate_verification(false);
|
||||||
|
|
||||||
for (auto h : _headers)
|
for (auto const h : _headers)
|
||||||
head.emplace(h.first, h.second);
|
head.emplace(h.first, h.second);
|
||||||
|
|
||||||
if (auto result = client.Post(getPath(target).c_str(), head, body, content_type)) {
|
if (auto result = client.Post(getPath(target).c_str(), head, body, content_type)) {
|
||||||
|
@ -187,7 +187,7 @@ HTTPResponse HTTPRequest::post(const char *body, const char *content_type) {
|
||||||
ret._status = response.status;
|
ret._status = response.status;
|
||||||
ret._body = response.body;
|
ret._body = response.body;
|
||||||
|
|
||||||
for (auto h : response.headers)
|
for (auto const h : response.headers)
|
||||||
ret._headers.emplace(h.first, h.second);
|
ret._headers.emplace(h.first, h.second);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue