Skip to content

Commit

Permalink
Only append a search param if the value is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-aitken committed Dec 20, 2023
1 parent 5359af1 commit 03703af
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/src/searchParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export function urlWithSearchParams(

const urlObj = new URL(url);
for (const [key, value] of Object.entries(params)) {
urlObj.searchParams.append(key, String(value));
if (value !== undefined) {
urlObj.searchParams.append(key, String(value));
}
}
return urlObj.toString();
}

0 comments on commit 03703af

Please sign in to comment.