Fix datatypes in headers other than strings (#6233)

This commit is contained in:
sunn 2020-05-12 08:51:24 +02:00 committed by GitHub
parent c1d47a580b
commit 1f82facf82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -144,8 +144,8 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName
QByteArray output = {{paramName}}.asByteArray();{{/isFile}} QByteArray output = {{paramName}}.asByteArray();{{/isFile}}
input.request_body.append(output); input.request_body.append(output);
{{/isContainer}}{{/bodyParams}}{{#headerParams}} {{/isContainer}}{{/bodyParams}}{{#headerParams}}
if ({{paramName}} != nullptr) { if (!::{{cppNamespace}}::toStringValue({{paramName}}).isEmpty()) {
input.headers.insert("{{baseName}}", {{paramName}}); input.headers.insert("{{baseName}}", ::{{cppNamespace}}::toStringValue({{paramName}}));
} }
{{/headerParams}} {{/headerParams}}

View File

@ -135,8 +135,8 @@ void PFXPetApi::deletePet(const qint64 &pet_id, const QString &api_key) {
worker->setWorkingDirectory(_workingDirectory); worker->setWorkingDirectory(_workingDirectory);
PFXHttpRequestInput input(fullPath, "DELETE"); PFXHttpRequestInput input(fullPath, "DELETE");
if (api_key != nullptr) { if (!::test_namespace::toStringValue(api_key).isEmpty()) {
input.headers.insert("api_key", api_key); input.headers.insert("api_key", ::test_namespace::toStringValue(api_key));
} }
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }