We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have noticed that the convertToHttpParams method is susceptible to undefined parameters. This can be verified using the following example:
public getCars(filter?: CarFilter): Observable<ResourceCollection<CarItem>> { const params = { ...filter // additional params... }; return this.resourceHateoasService.getCollection(CarItem, { params }); }
This method is now called by a business service:
getCarsByPerson(manufacturer: string | undefined, personId: string): Observable<CarItem[]> { const filter = { manufacturer, personId } as CarFilter; return this.carResourceService.getCars(filter).pipe( catchError(() => { return of(new ResourceCollection<CarItem>()) }), map(page => page.resources) ); }
If a call is now made without a manufacturer, the following error is thrown:
ERROR TypeError: value is undefined convertToHttpParams lagoshny-ngx-hateoas-client.mjs:517 convertToHttpOptions lagoshny-ngx-hateoas-client.mjs:540 get lagoshny-ngx-hateoas-client.mjs:1623 getResourceCollection lagoshny-ngx-hateoas-client.mjs:1653 getCollection lagoshny-ngx-hateoas-client.mjs:2406 getCars car-resource.service.ts:19
As a workaround, the filter can be created as follows:
const filter = { ...(manufacturer !== undefined && { manufacturer }), personId } as CarFilter;
I would like ngx-hateoas-client to be able to handle undefined parameters in the future. I look forward to your feedback.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have noticed that the convertToHttpParams method is susceptible to undefined parameters. This can be verified using the following example:
This method is now called by a business service:
If a call is now made without a manufacturer, the following error is thrown:
As a workaround, the filter can be created as follows:
I would like ngx-hateoas-client to be able to handle undefined parameters in the future. I look forward to your feedback.
The text was updated successfully, but these errors were encountered: