diff --git a/src/utils.ts b/src/utils.ts index 64b1816..314fc19 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,7 +1,8 @@ -// https://stackoverflow.com/a/62969380 -export function buildQueryString(query: Record): string { +// https://stackoverflow.com/a/62969380 + fix to remove empty entries (.filter(entry => entry)) +export function buildQueryString(query: Record): string { return Object.entries(query) .map(([key, value]) => (key && value ? `${key}=${value}` : "")) + .filter((entry) => entry) .join("&"); }