Skip to content

Commit 4420fda

Browse files
fix(client): preserve URL params already embedded in path
1 parent 842b67e commit 4420fda

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/client.ts

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

262262
const defaultQuery = this.defaultQuery();
263-
if (!isEmptyObj(defaultQuery)) {
264-
query = { ...defaultQuery, ...query };
263+
const pathQuery = Object.fromEntries(url.searchParams);
264+
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
265+
query = { ...pathQuery, ...defaultQuery, ...query };
265266
}
266267

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

0 commit comments

Comments
 (0)