gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] 03/03: browser fixes


From: gnunet
Subject: [taler-wallet-core] 03/03: browser fixes
Date: Wed, 06 Jan 2021 18:10:07 +0100

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

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

commit 3773a4cdfff26297981094cb5c48e755ac75a77c
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Jan 6 18:09:59 2021 +0100

    browser fixes
---
 packages/taler-wallet-webextension/src/browserHttpLib.ts | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/packages/taler-wallet-webextension/src/browserHttpLib.ts 
b/packages/taler-wallet-webextension/src/browserHttpLib.ts
index bfc85563..08364e40 100644
--- a/packages/taler-wallet-webextension/src/browserHttpLib.ts
+++ b/packages/taler-wallet-webextension/src/browserHttpLib.ts
@@ -24,6 +24,7 @@ import {
   HttpRequestOptions,
   HttpResponse,
   Headers,
+  bytesToString,
 } from "taler-wallet-core";
 import { TalerErrorCode } from "taler-wallet-core";
 
@@ -78,10 +79,16 @@ export class BrowserHttpLib implements HttpRequestLibrary {
             reject(exc);
             return;
           }
+          const makeText = async (): Promise<string> => {
+            const td = new TextDecoder();
+            return td.decode(myRequest.response);
+          };
           const makeJson = async (): Promise<any> => {
             let responseJson;
             try {
-              responseJson = JSON.parse(myRequest.responseText);
+              const td = new TextDecoder();
+              const responseString = td.decode(myRequest.response);
+              responseJson = JSON.parse(responseString);
             } catch (e) {
               throw OperationFailedError.fromCode(
                 TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,
@@ -126,7 +133,7 @@ export class BrowserHttpLib implements HttpRequestLibrary {
             headers: headerMap,
             requestMethod: method,
             json: makeJson,
-            text: async () => myRequest.responseText,
+            text: makeText,
             bytes: async () => myRequest.response,
           };
           resolve(resp);
@@ -149,7 +156,7 @@ export class BrowserHttpLib implements HttpRequestLibrary {
   ): Promise<HttpResponse> {
     return this.fetch(url, {
       method: "POST",
-      body,
+      body: JSON.stringify(body),
       ...opt,
     });
   }

-- 
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]