diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-06-16 13:28:35 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-06-18 19:36:32 +0200 |
commit | 10867950474a360426685ad888237a5542b0cfac (patch) | |
tree | 0b7e65f5e04a5eb07e59381e1da15b157e8b41fe | |
parent | 56575aaed81e1d55e41f577d7b6683702e4c0384 (diff) | |
download | libquotient-10867950474a360426685ad888237a5542b0cfac.tar.gz libquotient-10867950474a360426685ad888237a5542b0cfac.zip |
operation.cpp.mustache: streamline RequestData construction
That `std::move(_data)` never worked because the passed object is
a precursor to RequestData, and RequestData always takes things by
const-ref or by value, never by rvalue. Also, explicit mention of
RequestData is unnecessary, as its constructors are implicit by design.
-rw-r--r-- | gtad/operation.cpp.mustache | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gtad/operation.cpp.mustache b/gtad/operation.cpp.mustache index 3d26ec73..4b75434c 100644 --- a/gtad/operation.cpp.mustache +++ b/gtad/operation.cpp.mustache @@ -34,20 +34,20 @@ QUrl {{camelCaseOperationId}}Job::makeRequestUrl(QUrl baseUrl{{#allParams?}}, { {{#headerParams}} setRequestHeader("{{baseName}}", {{paramName}}.toLatin1()); {{/headerParams}}{{#inlineBody}}{{^propertyMap}}{{^bodyParams?}} - setRequestData(RequestData({{#consumesNonJson?}}{{nameCamelCase}}{{/consumesNonJson? - }}{{^consumesNonJson?}}toJson({{nameCamelCase}}){{/consumesNonJson?}})); + setRequestData({ {{#consumesNonJson?}}{{nameCamelCase}}{{/consumesNonJson? + }}{{^consumesNonJson?}}toJson({{nameCamelCase}}){{/consumesNonJson?}} }); {{/bodyParams?}}{{/propertyMap}}{{/inlineBody }}{{^consumesNonJson?}}{{#bodyParams?}} - QJsonObject _data; + QJsonObject _dataJson; {{#propertyMap}} - fillJson(_data, {{nameCamelCase}}); + fillJson(_dataJson, {{nameCamelCase}}); {{/propertyMap}}{{#inlineBody}} - fillJson<{{>maybeOmittableType}}>(_data, {{paramName}}); + fillJson<{{>maybeOmittableType}}>(_dataJson, {{paramName}}); {{/inlineBody}}{{#bodyParams}} - addParam<{{^required?}}IfNotEmpty{{/required?}}>(_data, + addParam<{{^required?}}IfNotEmpty{{/required?}}>(_dataJson, QStringLiteral("{{baseName}}"), {{paramName}}); {{/bodyParams}} - setRequestData(std::move(_data)); + setRequestData({ _dataJson }); {{/bodyParams?}}{{/consumesNonJson?}}{{#producesNonJson?}} setExpectedContentTypes({ {{#produces}}"{{_}}"{{>cjoin}}{{/produces}} }); {{/producesNonJson?}}{{^producesNonJson? |