feat: disable caching when NODE_ENV is development (#4543)

Co-authored-by: Alexandr <qwerty541zxc@gmail.com>
This commit is contained in:
Ophelia Goldstein
2025-10-08 02:12:28 +03:00
committed by GitHub
co-authored by Alexandr
parent 879463b14e
commit 956d6deded
+5 -2
View File
@@ -47,7 +47,7 @@ const disableCaching = (res) => {
* @param {number} cacheSeconds The cache seconds to set in the headers.
*/
const setCacheHeaders = (res, cacheSeconds) => {
if (cacheSeconds < 1) {
if (cacheSeconds < 1 || process.env.NODE_ENV === "development") {
disableCaching(res);
return;
}
@@ -69,7 +69,10 @@ const setErrorCacheHeaders = (res) => {
const envCacheSeconds = process.env.CACHE_SECONDS
? parseInt(process.env.CACHE_SECONDS, 10)
: NaN;
if (!isNaN(envCacheSeconds) && envCacheSeconds < 1) {
if (
(!isNaN(envCacheSeconds) && envCacheSeconds < 1) ||
process.env.NODE_ENV === "development"
) {
disableCaching(res);
return;
}