Skip to content

Commit 1a4be5a

Browse files
fix(client): preserve URL params already embedded in path
1 parent 77a7e9a commit 1a4be5a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/core.ts

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

540540
const defaultQuery = this.defaultQuery();
541-
if (!isEmptyObj(defaultQuery)) {
542-
query = { ...defaultQuery, ...query } as Req;
541+
const pathQuery = Object.fromEntries(url.searchParams);
542+
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
543+
query = { ...pathQuery, ...defaultQuery, ...query } as Req;
543544
}
544545

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

0 commit comments

Comments
 (0)