From 972ad566fea7e033c45e217dbfcb949d90ea2cb5 Mon Sep 17 00:00:00 2001 From: Dheeraj Nalluri Date: Thu, 3 Jun 2021 00:58:53 -0500 Subject: [PATCH] [typescript-angular] Fix undefined query param (#9657) --- .../main/resources/typescript-angular/api.service.mustache | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache index 8f66fcf6f9e..4fe3186f1ad 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache @@ -93,11 +93,16 @@ export class {{classname}} { {{/hasSomeFormParams}} private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + {{#isQueryParamObjectFormatJson}} + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + {{/isQueryParamObjectFormatJson}} + {{^isQueryParamObjectFormatJson}} if (typeof value === "object" && value instanceof Date === false) { httpParams = this.addToHttpParamsRecursive(httpParams, value); } else { httpParams = this.addToHttpParamsRecursive(httpParams, value, key); } + {{/isQueryParamObjectFormatJson}} return httpParams; }