Bug Report Checklist
Description
There is a change in the post httparams behaviour in the typescript services with the base Service new implementation
openapi-generator version
7.11 was fine 7.12 add a regression
Bug
The function addToHttpParams in 7.11 version
// @ts-ignore
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
if (typeof value === "object" && value instanceof Date === false) {
httpParams = this.addToHttpParamsRecursive(httpParams, value);
} else {
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
}
return httpParams;
}
With this implementation the output was http://localhost:8090/api/persons?name=dd for a simple object containing a variable name
Now the new implementation
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
// If the value is an object (but not a Date), recursively add its keys.
if (typeof value === 'object' && !(value instanceof Date)) {
return this.addToHttpParamsRecursive(httpParams, value, key);
}
return this.addToHttpParamsRecursive(httpParams, value, key);
}
Is producing the output http://localhost:8090/api/persons?criteria=%7B%22name%22%3A%22eee%22%7D.
The else is missing, then a json is used as a query parameter and then enconded.
Bug Report Checklist
Description
There is a change in the post httparams behaviour in the typescript services with the base Service new implementation
openapi-generator version
7.11 was fine 7.12 add a regression
Bug
The function addToHttpParams in 7.11 version
// @ts-ignore
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
if (typeof value === "object" && value instanceof Date === false) {
httpParams = this.addToHttpParamsRecursive(httpParams, value);
} else {
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
}
return httpParams;
}
With this implementation the output was http://localhost:8090/api/persons?name=dd for a simple object containing a variable name
Now the new implementation
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
// If the value is an object (but not a Date), recursively add its keys.
if (typeof value === 'object' && !(value instanceof Date)) {
return this.addToHttpParamsRecursive(httpParams, value, key);
}
return this.addToHttpParamsRecursive(httpParams, value, key);
}
Is producing the output http://localhost:8090/api/persons?criteria=%7B%22name%22%3A%22eee%22%7D.
The else is missing, then a json is used as a query parameter and then enconded.