@@ -98,6 +98,18 @@ const char* {{classname}}Exception::what() const noexcept
9898{ {/isPrimitiveType} }
9999{ {/allParams} }
100100{ {/hasBodyParam} }
101+ { {#hasFormParams} }
102+ // form param
103+ std::stringstream formParams;
104+ { {#allParams} }
105+ { {#isFormParam} }
106+ formParams << "{ {{paramName} }}=";
107+ formParams << base64encode({ {{paramName} }});
108+ { {^-last} }formParams << '& ';{ {/-last} }
109+ { {/isFormParam} }
110+ { {/allParams} }
111+ requestBody = formParams.str();
112+ { {/hasFormParams} }
101113{ {#hasPathParams} }
102114 // path params
103115 const auto formattedPath = boost::format(path){ {#pathParams} } % { {{paramName} }}{ {/pathParams} };
@@ -161,12 +173,16 @@ const char* {{classname}}Exception::what() const noexcept
161173 if (statusCode == boost::beast::http::status({ {code} })) {
162174 {{#is2xx} }
163175 { {#returnType} }
164- { {#isModel} }
165176 { {#isString} }
166177 result = responseBody;
167178 { {/isString} }
179+ { {#isModel} }
168180 { {^isString} }
181+ { {^isMap} }
182+ { {^isArray} }
169183 result->fromJsonString(responseBody);
184+ { {/isArray} }
185+ { {/isMap} }
170186 { {/isString} }
171187 { {/isModel} }
172188 { {#isArray} }
@@ -247,6 +263,10 @@ const char* {{classname}}Exception::what() const noexcept
247263 queryParamStream << "{ {{paramName} }}=" << { {paramName} };
248264 { {^-last} }queryParamStream << '& ';{ {/-last} }
249265 { {/isPrimitiveType} }
266+ { {#isContainer} }
267+ queryParamStream << "{ {{paramName} }}=";
268+ queryParamStream << boost::algorithm::join({ {{paramName} }}, ",");
269+ { {/isContainer} }
250270 { {/queryParams} }
251271 path += queryParamStream.str();
252272 { {/hasQueryParams} }
@@ -292,16 +312,32 @@ const char* {{classname}}Exception::what() const noexcept
292312 if (statusCode == boost::beast::http::status({ {code} })) {
293313 {{#is2xx} }
294314 { {#returnType} }
295- { {#isModel} }
296315 { {#isString} }
297316 result = responseBody;
298317 { {/isString} }
318+ { {#isModel} }
299319 { {^isString} }
320+ { {^isMap} }
321+ { {^isArray} }
300322 result->fromJsonString(responseBody);
323+ { {/isArray} }
324+ { {/isMap} }
301325 { {/isString} }
302326 { {/isModel} }
327+ { {#isArray} }
328+ createModelVectorFromJsonString(result, responseBody);
329+ { {/isArray} }
303330 { {#isMap} }
304- // TODO result = convertMapResponse(resultObject);
331+ if (not responseBody.empty()) {
332+ std::stringstream responseStream(responseBody);
333+ boost::property_tree::ptree pt;
334+ boost::property_tree::read_json(responseStream, pt);
335+ {{#additionalProperties} }
336+ for (const auto& kv : pt) {
337+ result.insert (std::make_pair(kv.first, boost::lexical_cast< {{{dataType} }}>(kv.second.data())));
338+ }
339+ { {/additionalProperties} }
340+ }
305341 { {/isMap} }
306342 { {/returnType} }
307343 { {/is2xx} }
0 commit comments