taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit f414ca39e446563eb10c3c20defe79952fe71e6a
parent ae4d4647e988a6eb8e9fd87af3385371ba56ab43
Author: Sebastian <sebasjm@gmail.com>
Date:   Wed, 15 Mar 2023 09:55:01 -0300

prevent cors and cache options

Diffstat:
Mpackages/web-util/src/utils/request.ts | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/packages/web-util/src/utils/request.ts b/packages/web-util/src/utils/request.ts @@ -51,6 +51,8 @@ export async function defaultRequestHandler<T>( const requestBody = options?.data; const requestTimeout = options?.timeout ?? 5 * 1000; const requestParams = options.params ?? {}; + const requestPreventCache = options.preventCache ?? false; + const requestPreventCors = options.preventCors ?? false; const _url = new URL(`${baseUrl}${endpoint}`); @@ -84,7 +86,8 @@ export async function defaultRequestHandler<T>( headers: requestHeaders, method: requestMethod, credentials: "omit", - mode: "cors", + mode: requestPreventCors ? "no-cors" : "cors", + cache: requestPreventCache ? "no-cache" : "default", body: payload, signal: controller.signal, }); @@ -301,6 +304,8 @@ export interface RequestOptions { username: string; password: string; }; + preventCache?: boolean; + preventCors?: boolean; data?: any; params?: unknown; timeout?: number;