gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] 01/06: use URL api to stringify payto://


From: gnunet
Subject: [taler-wallet-core] 01/06: use URL api to stringify payto://
Date: Tue, 17 Jan 2023 20:01:38 +0100

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a commit to branch master
in repository wallet-core.

commit 3cde52effc5bc1ec82285b52938bc024083c3278
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Mon Jan 16 19:34:44 2023 -0300

    use URL api to stringify payto://
---
 packages/taler-util/src/payto.ts | 11 +++++------
 1 file 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;
 }
 
 /**

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]