gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] 01/02: add missing response code


From: gnunet
Subject: [taler-wallet-core] 01/02: add missing response code
Date: Sun, 22 Oct 2023 01:26:03 +0200

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

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

commit 4b98b693d696d90f30f0a6546b0e1f4bc181a5f2
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Sat Oct 21 20:23:11 2023 -0300

    add missing response code
---
 packages/taler-util/src/http-client/bank-core.ts | 6 +++++-
 packages/taler-util/src/http-client/types.ts     | 5 ++++-
 packages/web-util/src/utils/http-impl.browser.ts | 2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/packages/taler-util/src/http-client/bank-core.ts 
b/packages/taler-util/src/http-client/bank-core.ts
index 033b78f67..c49a094e4 100644
--- a/packages/taler-util/src/http-client/bank-core.ts
+++ b/packages/taler-util/src/http-client/bank-core.ts
@@ -166,7 +166,7 @@ export class TalerCoreBankHttpClient {
    * 
    */
   async updatePassword(auth: UserAndToken, body: 
TalerCorebankApi.AccountPasswordChange) {
-    const url = new URL(`accounts/${auth.username}`, this.baseUrl);
+    const url = new URL(`accounts/${auth.username}/auth`, this.baseUrl);
     const resp = await this.httpLib.fetch(url.href, {
       method: "PATCH",
       body,
@@ -179,6 +179,8 @@ export class TalerCoreBankHttpClient {
       //FIXME: missing in docs
       case HttpStatusCode.NotFound: return opKnownFailure("not-found", resp);
       //FIXME: missing in docs
+      case HttpStatusCode.Unauthorized: return opKnownFailure("no-rights", 
resp);
+      //FIXME: missing in docs
       case HttpStatusCode.Forbidden: return opKnownFailure("unauthorized", 
resp);
       default: return opUnknownFailure(resp, await resp.text())
     }
@@ -241,6 +243,8 @@ export class TalerCoreBankHttpClient {
     });
     switch (resp.status) {
       case HttpStatusCode.Ok: return opSuccess(resp, codecForAccountData())
+      //FIXME: missing in docs (401 when not found?)
+      case HttpStatusCode.Unauthorized: return opKnownFailure("not-found", 
resp);
       //FIXME: missing in docs
       case HttpStatusCode.NotFound: return opKnownFailure("not-found", resp);
       //FIXME: missing in docs
diff --git a/packages/taler-util/src/http-client/types.ts 
b/packages/taler-util/src/http-client/types.ts
index 5a76981df..b0d6c163b 100644
--- a/packages/taler-util/src/http-client/types.ts
+++ b/packages/taler-util/src/http-client/types.ts
@@ -1017,9 +1017,12 @@ export namespace TalerCorebankApi {
 
 
   export interface AccountPasswordChange {
-
+    // FIXME: missing in docs
     // New password.
     new_password: string;
+    // Old password. If present, chec that the old password matches.
+    // Optional for admin account.
+    old_password?: string;
   }
 
   export interface PublicAccountsResponse {
diff --git a/packages/web-util/src/utils/http-impl.browser.ts 
b/packages/web-util/src/utils/http-impl.browser.ts
index f19d1fe61..db789a536 100644
--- a/packages/web-util/src/utils/http-impl.browser.ts
+++ b/packages/web-util/src/utils/http-impl.browser.ts
@@ -69,7 +69,7 @@ export class BrowserHttpLib implements HttpRequestLibrary {
     }
 
     let myBody: ArrayBuffer | undefined =
-      requestMethod === "POST" || requestMethod === "PUT"
+      requestMethod === "POST" || requestMethod === "PUT" || requestMethod === 
"PATCH"
         ? encodeBody(requestBody)
         : undefined;
 

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