diff options
Diffstat (limited to 'packages/taler-util/src')
-rw-r--r-- | packages/taler-util/src/payto.ts | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/packages/taler-util/src/payto.ts b/packages/taler-util/src/payto.ts index 8eb0b88a8..1ac081a76 100644 --- a/packages/taler-util/src/payto.ts +++ b/packages/taler-util/src/payto.ts @@ -81,13 +81,12 @@ export function addPaytoQueryParams( * @returns */ export function stringifyPaytoUri(p: PaytoUri): string { - const url = `${paytoPfx}${p.targetType}/${p.targetPath}`; + const url = new URL(`${paytoPfx}${p.targetType}/${p.targetPath}`); const paramList = !p.params ? [] : Object.entries(p.params); - if (paramList.length > 0) { - const search = paramList.map(([key, value]) => `${key}=${value}`).join("&"); - return `${url}?${search}`; - } - return url; + paramList.forEach(([key, value]) => { + url.searchParams.set(key, value) + }) + return url.href; } /** |