prevent cors and cache options
This commit is contained in:
parent
ae4d4647e9
commit
f414ca39e4
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user