fix: remove called to deprecated url.resolve (#106501)

* fix: remove called to deprecated url.resolve

* simplify joining of URL parts
This commit is contained in:
Mark Hopkin 2021-07-28 08:36:41 +01:00 committed by GitHub
parent 0bb761de32
commit 0c4c662ce7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,6 @@
*/
import { pick, throttle, cloneDeep } from 'lodash';
import { resolve as resolveUrl } from 'url';
import type { PublicMethodsOf } from '@kbn/utility-types';
import {
@ -121,7 +120,7 @@ interface BatchQueueEntry {
reject: (reason?: any) => void;
}
const join = (...uriComponents: Array<string | undefined>) =>
const joinUriComponents = (...uriComponents: Array<string | undefined>) =>
uriComponents
.filter((comp): comp is string => Boolean(comp))
.map(encodeURIComponent)
@ -511,7 +510,7 @@ export class SavedObjectsClient {
}
private getPath(path: Array<string | undefined>): string {
return resolveUrl(API_BASE_URL, join(...path));
return API_BASE_URL + joinUriComponents(...path);
}
/**