diff options
Diffstat (limited to 'packages/web-util/src/utils/request.ts')
-rw-r--r-- | packages/web-util/src/utils/request.ts | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/packages/web-util/src/utils/request.ts b/packages/web-util/src/utils/request.ts index 944e65945..0c11c8c8a 100644 --- a/packages/web-util/src/utils/request.ts +++ b/packages/web-util/src/utils/request.ts @@ -28,8 +28,6 @@ export enum ErrorType { UNEXPECTED, } - - /** * * @param baseUrl URL where the service is located @@ -53,7 +51,9 @@ export async function defaultRequestHandler<T>( } requestHeaders["Content-Type"] = - !options.contentType || options.contentType === "json" ? "application/json" : "text/plain"; + !options.contentType || options.contentType === "json" + ? "application/json" + : "text/plain"; if (options.talerAmlOfficerSignature) { requestHeaders["Taler-AML-Officer-Signature"] = @@ -83,7 +83,7 @@ export async function defaultRequestHandler<T>( loading: false, message: `invalid URL: "${baseUrl}${endpoint}"`, }; - throw new RequestError(error) + throw new RequestError(error); } Object.entries(requestParams).forEach(([key, value]) => { @@ -114,7 +114,7 @@ export async function defaultRequestHandler<T>( loading: false, message: `unsupported request body type: "${typeof requestBody}"`, }; - throw new RequestError(error) + throw new RequestError(error); } } @@ -159,7 +159,7 @@ export async function defaultRequestHandler<T>( type: ErrorType.UNEXPECTED, exception: ex, loading: false, - message: (ex instanceof Error ? ex.message : ""), + message: ex instanceof Error ? ex.message : "", }; throw new RequestError(error); } @@ -470,9 +470,8 @@ export function buildRequestFailed<ErrorDetail>( */ function validateURL(baseUrl: string, endpoint: string): URL | undefined { try { - return new URL(`${baseUrl}${endpoint}`) + return new URL(`${baseUrl}${endpoint}`); } catch (ex) { - return undefined + return undefined; } - -}
\ No newline at end of file +} |