fix(sdk-js): remove trailing slash from url

This commit is contained in:
bracesproul
2024-11-19 09:23:47 -08:00
parent b1779cf348
commit b3fa43e4a6
+2 -1
View File
@@ -62,7 +62,8 @@ class BaseClient {
// default limit being capped by Chrome
// https://github.com/nodejs/undici/issues/1373
this.apiUrl = config?.apiUrl || "http://localhost:8123";
// Regex to remove trailing slash, if present
this.apiUrl = config?.apiUrl?.replace(/\/$/, "") || "http://localhost:8123";
this.defaultHeaders = config?.defaultHeaders || {};
if (config?.apiKey != null) {
this.defaultHeaders["X-Api-Key"] = config.apiKey;