support external for api

This commit is contained in:
liangping 2023-12-16 19:13:31 +08:00
parent bfedae38f1
commit 9233a4e8ef

View File

@ -21,7 +21,7 @@ export class BaseRestClient<R extends AbstractRegistry> {
this.registry = registry;
}
async request<T>(request: Request<T>, args: Record<string, any>, query = '') {
let url = `${this.endpoint}${request.url}${query}`;
let url = `${request.url.startsWith("http")?'':this.endpoint}${request.url}${query}`;
Object.keys(args).forEach((k) => {
url = url.replace(`{${k}}`, args[k] || '');
});