Skip to content

Commit ff159b3

Browse files
fix(client): preserve URL params already embedded in path
1 parent c0dc840 commit ff159b3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/core.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,9 @@ export abstract class APIClient {
524524
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
525525

526526
const defaultQuery = this.defaultQuery();
527-
if (!isEmptyObj(defaultQuery)) {
528-
query = { ...defaultQuery, ...query } as Req;
527+
const pathQuery = Object.fromEntries(url.searchParams);
528+
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
529+
query = { ...pathQuery, ...defaultQuery, ...query } as Req;
529530
}
530531

531532
if (typeof query === 'object' && query && !Array.isArray(query)) {

0 commit comments

Comments
 (0)