diff options
-rw-r--r-- | packages/web-util/src/utils/request.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/web-util/src/utils/request.ts b/packages/web-util/src/utils/request.ts index c7bca2de9..d05a4ec84 100644 --- 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; |