Skip to content

Commit 6b49627

Browse files
committed
[typescript-angular] Encode objects for multipart/form-data with json - fixes OpenAPITools#2733
1 parent 14a3934 commit 6b49627

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ export class {{classname}} {
342342
{{/isListContainer}}
343343
{{^isListContainer}}
344344
if ({{paramName}} !== undefined) {
345-
{{#useHttpClient}}formParams = {{/useHttpClient}}formParams.append('{{baseName}}', <any>{{paramName}}){{#useHttpClient}} as any || formParams{{/useHttpClient}};
345+
{{#useHttpClient}}formParams = {{/useHttpClient}}formParams.append('{{baseName}}', {{^isModel}}<any>{{paramName}}{{/isModel}}{{#isModel}}useForm ? JSON.stringify({{paramName}}) : <any>{{paramName}}{{/isModel}}){{#useHttpClient}} as any || formParams{{/useHttpClient}};
346346
}
347347
{{/isListContainer}}
348348
{{/formParams}}

0 commit comments

Comments
 (0)