Remove trailing slash from generic service _getOne (if empty path)

This commit is contained in:
Adina Țeudan 2024-02-19 11:19:36 +02:00
parent 6f255d68b4
commit 124ecee0bf

View File

@ -112,7 +112,7 @@ export abstract class GenericService<I> {
protected _getOne<R = I>(path: List, modelPath = this._defaultModelPath, queryParams?: List<QueryParam>): Observable<R> {
const entityPath = path.map(item => encodeURIComponent(item)).join('/');
return this._http.get<R>(`/${this._serviceName}/${encodeURI(modelPath)}/${entityPath}`, {
return this._http.get<R>(`/${this._serviceName}/${encodeURI(modelPath)}/${entityPath}`.replace(/\/+$/, ''), {
headers: HeadersConfiguration.getHeaders({ contentType: false }),
params: this._queryParams(queryParams),
observe: 'body',