From 1f82facf82024d2097fbd96b2ae158997333c044 Mon Sep 17 00:00:00 2001 From: sunn <33183834+etherealjoy@users.noreply.github.com> Date: Tue, 12 May 2020 08:51:24 +0200 Subject: [PATCH] Fix datatypes in headers other than strings (#6233) --- .../src/main/resources/cpp-qt5-client/api-body.mustache | 4 ++-- samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-body.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-body.mustache index b08cd6a9065..a074b516e83 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-body.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-body.mustache @@ -144,8 +144,8 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName QByteArray output = {{paramName}}.asByteArray();{{/isFile}} input.request_body.append(output); {{/isContainer}}{{/bodyParams}}{{#headerParams}} - if ({{paramName}} != nullptr) { - input.headers.insert("{{baseName}}", {{paramName}}); + if (!::{{cppNamespace}}::toStringValue({{paramName}}).isEmpty()) { + input.headers.insert("{{baseName}}", ::{{cppNamespace}}::toStringValue({{paramName}})); } {{/headerParams}} diff --git a/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp b/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp index cb50dee94b2..c94bcc0da8a 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp @@ -135,8 +135,8 @@ void PFXPetApi::deletePet(const qint64 &pet_id, const QString &api_key) { worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "DELETE"); - if (api_key != nullptr) { - input.headers.insert("api_key", api_key); + if (!::test_namespace::toStringValue(api_key).isEmpty()) { + input.headers.insert("api_key", ::test_namespace::toStringValue(api_key)); } foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }