quiver-client 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +7 -1
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -25,7 +25,13 @@ export class Client {
|
|
|
25
25
|
#timeoutMs;
|
|
26
26
|
#fetch;
|
|
27
27
|
constructor(baseUrl = DEFAULT_BASE_URL, opts = {}) {
|
|
28
|
-
|
|
28
|
+
// Strip trailing slashes with a linear scan rather than a quantified regex
|
|
29
|
+
// (`/\/+$/`), which static analysis flags as polynomial-backtracking on the
|
|
30
|
+
// caller-supplied base URL.
|
|
31
|
+
let end = baseUrl.length;
|
|
32
|
+
while (end > 0 && baseUrl.charCodeAt(end - 1) === 47 /* "/" */)
|
|
33
|
+
end--;
|
|
34
|
+
this.#baseUrl = baseUrl.slice(0, end);
|
|
29
35
|
this.#headers = { "content-type": "application/json" };
|
|
30
36
|
if (opts.apiKey) {
|
|
31
37
|
this.#headers["authorization"] = `Bearer ${opts.apiKey}`;
|
package/package.json
CHANGED