@nowarajs/elysia-cache 1.2.5 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +3 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -26,6 +26,8 @@ var cache = ({
26
26
  set.headers["etag"] = `"${prefix}${cacheKey}"`;
27
27
  set.headers["expires"] = new Date(Date.now() + defaultTtl * 1000).toUTCString();
28
28
  set.headers["last-modified"] = metadata.createdAt;
29
+ if (response instanceof Response)
30
+ return response.clone();
29
31
  return response;
30
32
  }
31
33
  set.headers["x-cache"] = "MISS";
@@ -48,7 +50,7 @@ var cache = ({
48
50
  if (!set.headers["x-cache"])
49
51
  set.headers["x-cache"] = "MISS";
50
52
  const cacheData = {
51
- response,
53
+ response: response instanceof Response ? response.clone() : response,
52
54
  metadata: {
53
55
  createdAt: now.toUTCString(),
54
56
  ttl
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nowarajs/elysia-cache",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "author": "NowaraJS",
5
5
  "description": "A template to create a bun package.",
6
6
  "type": "module",