diff --git a/src/middleware/cache.ts b/src/middleware/cache.ts index 8e80005..f0e8ae5 100644 --- a/src/middleware/cache.ts +++ b/src/middleware/cache.ts @@ -19,7 +19,9 @@ export const cache = (opts: CacheOpts): MiddlewareHandler => { await next(); const res = c.res.clone(); if (res.status < 500) { + const old = response; response = res; + old?.text(); // Prevent memory leaks. } return res; }