|
|
@ -38,9 +38,9 @@ export class RestService { |
|
|
api = api || this.getApiFromStore(config.apiName); |
|
|
api = api || this.getApiFromStore(config.apiName); |
|
|
const { method, params, ...options } = request; |
|
|
const { method, params, ...options } = request; |
|
|
const { observe = Rest.Observe.Body, skipHandleError } = config; |
|
|
const { observe = Rest.Observe.Body, skipHandleError } = config; |
|
|
|
|
|
const url = this.removeDuplicateSlashes(api + request.url); |
|
|
return this.http |
|
|
return this.http |
|
|
.request<R>(method, api + request.url, { |
|
|
.request<R>(method, url, { |
|
|
observe, |
|
|
observe, |
|
|
...(params && { |
|
|
...(params && { |
|
|
params: this.getParams(params, config.httpParamEncoder), |
|
|
params: this.getParams(params, config.httpParamEncoder), |
|
|
@ -62,4 +62,8 @@ export class RestService { |
|
|
? new HttpParams({ encoder, fromObject: filteredParams }) |
|
|
? new HttpParams({ encoder, fromObject: filteredParams }) |
|
|
: new HttpParams({ fromObject: filteredParams }); |
|
|
: new HttpParams({ fromObject: filteredParams }); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private removeDuplicateSlashes(url: string): string { |
|
|
|
|
|
return url.replace(/([^:]\/)\/+/g, '$1'); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|