You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
}
bhahn57570
changed the title
[BUG] Change in addToHttpParams functioon ead to json encoding error
[BUG] Change in addToHttpParams function lead to json encoding error
Mar 27, 2025
bhahn57570
changed the title
[BUG] Change in addToHttpParams function lead to json encoding error
[BUG] Change in addToHttpParams function lead to json encoding error - Regression 7.12
Mar 28, 2025
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.
The text was updated successfully, but these errors were encountered: