From e249732653bd459bc7b52b9ac1cbd0e39f07f0eb Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Tue, 20 Sep 2022 19:43:53 +0800 Subject: [PATCH] Fix invalid url error in axios plugin --- src/plugins/AxiosPlugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/AxiosPlugin.ts b/src/plugins/AxiosPlugin.ts index 63b3e85..2889105 100644 --- a/src/plugins/AxiosPlugin.ts +++ b/src/plugins/AxiosPlugin.ts @@ -43,7 +43,7 @@ class AxiosPlugin implements SwPlugin { if (typeof url === 'string') config = config ? { ...config, url } : { url }; else config = url ? { ...url } : {}; - const { origin, host, pathname: operation } = new URL(config.url, config.baseURL); // TODO: this may throw invalid URL + const { origin, host, pathname: operation } = new URL(config.url, config.baseURL ?? this.defaults?.baseURL); const method = (config.method || 'GET').toUpperCase(); const span = ignoreHttpMethodCheck(method) ? DummySpan.create()