Skip to content

Commit 9ea6e7a

Browse files
committed
expose default headers, add headers to request
1 parent d065a6a commit 9ea6e7a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,15 @@ void
112112
{{/isContainer}}{{/bodyParams}}
113113

114114
{{#headerParams}}
115-
// TODO: add header support
115+
if ({{paramName}} != nullptr) {
116+
input.headers.insert("{{baseName}}", "{{paramName}}");
117+
}
116118
{{/headerParams}}
117119

120+
foreach(QString key, this->defaultHeaders.keys()) {
121+
input.headers.insert(key, this->defaultHeaders.value(key));
122+
}
123+
118124
connect(worker,
119125
&HttpRequestWorker::on_execution_finished,
120126
this,

modules/swagger-codegen/src/main/resources/qt5cpp/api-header.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public:
2323

2424
QString host;
2525
QString basePath;
26+
QMap<QString, QString> defaultHeaders;
2627

2728
{{#operations}}{{#operation}}void {{nickname}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
2829
{{/operation}}{{/operations}}

0 commit comments

Comments
 (0)