diff options
Diffstat (limited to 'packages/taler-wallet-core/src/util')
| -rw-r--r-- | packages/taler-wallet-core/src/util/http.ts | 14 | 
1 files changed, 12 insertions, 2 deletions
| diff --git a/packages/taler-wallet-core/src/util/http.ts b/packages/taler-wallet-core/src/util/http.ts index 118da40fe..1da31a315 100644 --- a/packages/taler-wallet-core/src/util/http.ts +++ b/packages/taler-wallet-core/src/util/http.ts @@ -68,7 +68,7 @@ export interface HttpRequestOptions {     */    cancellationToken?: CancellationToken; -  body?: string | ArrayBuffer | Object; +  body?: string | ArrayBuffer | Record<string, unknown>;  }  /** @@ -185,6 +185,7 @@ export async function readUnexpectedResponseDetails(      TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR,      {        requestUrl: httpResponse.requestUrl, +      requestMethod: httpResponse.requestMethod,        httpStatusCode: httpResponse.status,        errorResponse: errJson,      }, @@ -211,6 +212,7 @@ export async function readSuccessResponseJsonOrErrorCode<T>(        TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,        {          requestUrl: httpResponse.requestUrl, +        requestMethod: httpResponse.requestMethod,          httpStatusCode: httpResponse.status,          validationError: e.toString(),        }, @@ -223,11 +225,18 @@ export async function readSuccessResponseJsonOrErrorCode<T>(    };  } +type HttpErrorDetails = { +  requestUrl: string; +  requestMethod: string; +  httpStatusCode: number; +}; +  export function getHttpResponseErrorDetails(    httpResponse: HttpResponse, -): Record<string, unknown> { +): HttpErrorDetails {    return {      requestUrl: httpResponse.requestUrl, +    requestMethod: httpResponse.requestMethod,      httpStatusCode: httpResponse.status,    };  } @@ -240,6 +249,7 @@ export function throwUnexpectedRequestError(      TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR,      {        requestUrl: httpResponse.requestUrl, +      requestMethod: httpResponse.requestMethod,        httpStatusCode: httpResponse.status,        errorResponse: talerErrorResponse,      }, | 
