diff --git a/.changeset/honest-socks-thank.md b/.changeset/honest-socks-thank.md new file mode 100644 index 0000000..f44de9a --- /dev/null +++ b/.changeset/honest-socks-thank.md @@ -0,0 +1,5 @@ +--- +"@napolab/kv-response-cache": minor +--- + +add x-kv-cache header diff --git a/src/middleware.ts b/src/middleware.ts index 7d5e119..6c24a5f 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -21,7 +21,11 @@ export const kvCaches = const key = new URL(c.req.url).pathname; const response = await cache.match(key); - if (response) return response; + if (response) { + response.headers.set("X-KV-CACHE", "hit"); + + return response; + } await next();