mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-02 21:24:23 +01:00
cache: use the old response body to prevent memory leaks
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user