diff options
Diffstat (limited to 'packages/taler-wallet-webextension')
-rw-r--r-- | packages/taler-wallet-webextension/src/browserHttpLib.ts | 12 | ||||
-rw-r--r-- | packages/taler-wallet-webextension/src/serviceWorkerHttpLib.ts | 19 |
2 files changed, 23 insertions, 8 deletions
diff --git a/packages/taler-wallet-webextension/src/browserHttpLib.ts b/packages/taler-wallet-webextension/src/browserHttpLib.ts index 26fa8eb11..165a0037c 100644 --- a/packages/taler-wallet-webextension/src/browserHttpLib.ts +++ b/packages/taler-wallet-webextension/src/browserHttpLib.ts @@ -90,7 +90,8 @@ export class BrowserHttpLib implements HttpRequestLibrary { TalerError.fromDetail( TalerErrorCode.WALLET_NETWORK_ERROR, { - requestUrl: requestUrl, + requestUrl, + requestMethod, }, "Could not make request", ), @@ -103,7 +104,8 @@ export class BrowserHttpLib implements HttpRequestLibrary { const exc = TalerError.fromDetail( TalerErrorCode.WALLET_NETWORK_ERROR, { - requestUrl: requestUrl, + requestUrl, + requestMethod, }, "HTTP request failed (status 0, maybe URI scheme was wrong?)", ); @@ -124,7 +126,8 @@ export class BrowserHttpLib implements HttpRequestLibrary { throw TalerError.fromDetail( TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE, { - requestUrl: requestUrl, + requestUrl, + requestMethod, httpStatusCode: myRequest.status, }, "Invalid JSON from HTTP response", @@ -134,7 +137,8 @@ export class BrowserHttpLib implements HttpRequestLibrary { throw TalerError.fromDetail( TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE, { - requestUrl: requestUrl, + requestUrl, + requestMethod, httpStatusCode: myRequest.status, }, "Invalid JSON from HTTP response", diff --git a/packages/taler-wallet-webextension/src/serviceWorkerHttpLib.ts b/packages/taler-wallet-webextension/src/serviceWorkerHttpLib.ts index 82d11a15a..4b47e89d5 100644 --- a/packages/taler-wallet-webextension/src/serviceWorkerHttpLib.ts +++ b/packages/taler-wallet-webextension/src/serviceWorkerHttpLib.ts @@ -104,8 +104,8 @@ export class ServiceWorkerHttpLib implements HttpRequestLibrary { status: response.status, requestMethod, requestUrl, - json: makeJsonHandler(response, requestUrl), - text: makeTextHandler(response, requestUrl), + json: makeJsonHandler(response, requestUrl, requestMethod), + text: makeTextHandler(response, requestUrl, requestMethod), bytes: async () => (await response.blob()).arrayBuffer(), }; } catch (e) { @@ -145,7 +145,11 @@ export class ServiceWorkerHttpLib implements HttpRequestLibrary { } } -function makeTextHandler(response: Response, requestUrl: string) { +function makeTextHandler( + response: Response, + requestUrl: string, + requestMethod: string, +) { return async function getJsonFromResponse(): Promise<any> { let respText; try { @@ -155,6 +159,7 @@ function makeTextHandler(response: Response, requestUrl: string) { TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE, { requestUrl, + requestMethod, httpStatusCode: response.status, }, "Invalid JSON from HTTP response", @@ -164,7 +169,11 @@ function makeTextHandler(response: Response, requestUrl: string) { }; } -function makeJsonHandler(response: Response, requestUrl: string) { +function makeJsonHandler( + response: Response, + requestUrl: string, + requestMethod: string, +) { return async function getJsonFromResponse(): Promise<any> { let responseJson; try { @@ -174,6 +183,7 @@ function makeJsonHandler(response: Response, requestUrl: string) { TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE, { requestUrl, + requestMethod, httpStatusCode: response.status, }, "Invalid JSON from HTTP response", @@ -184,6 +194,7 @@ function makeJsonHandler(response: Response, requestUrl: string) { TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE, { requestUrl, + requestMethod, httpStatusCode: response.status, }, "Invalid JSON from HTTP response", |