fix: adds no-cache header when debug mode is ON (#5405)

This commit is contained in:
Anshuman Pandey
2025-04-17 14:33:44 +05:30
committed by GitHub
parent 5b9bf3ff43
commit 4dfd15d6dd
4 changed files with 4 additions and 5 deletions

View File

@@ -12,13 +12,12 @@ export const makeRequest = async <T>(
): Promise<Result<T, ApiErrorResponse>> => {
const url = new URL(appUrl + endpoint);
const body = data ? JSON.stringify(data) : undefined;
const res = await wrapThrowsAsync(fetch)(url.toString(), {
method,
headers: {
"Content-Type": "application/json",
...(isDebug && { "Cache-Control": "no-cache" }),
},
...(isDebug && { "Cache-Control": "no-cache" }),
body,
});

View File

@@ -164,8 +164,8 @@ describe("api.ts", () => {
method: "GET",
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-cache",
},
"Cache-Control": "no-cache",
});
});
});

View File

@@ -17,8 +17,8 @@ export const makeRequest = async <T>(
method,
headers: {
"Content-Type": "application/json",
...(isDebug && { "Cache-Control": "no-cache" }),
},
...(isDebug && { "Cache-Control": "no-cache" }),
body,
});

View File

@@ -164,8 +164,8 @@ describe("api.ts", () => {
method: "GET",
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-cache",
},
"Cache-Control": "no-cache",
});
});
});