From 31717c8c5a037a56d9be1c9bdfc4168ecf893762 Mon Sep 17 00:00:00 2001 From: oilbeater Date: Thu, 3 Oct 2024 22:00:14 +0800 Subject: [PATCH] fix type lint Signed-off-by: oilbeater --- src/middlewares/cache.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/middlewares/cache.ts b/src/middlewares/cache.ts index daa897c..d44cd9d 100644 --- a/src/middlewares/cache.ts +++ b/src/middlewares/cache.ts @@ -15,8 +15,8 @@ export const cacheMiddleware: MiddlewareHandler = async (c: Context, const cacheKeyHex = await generateCacheKey(c.req.url, await c.req.text()); const response = await c.env.MALACCA_CACHE.get(cacheKeyHex, "stream"); if (response) { - const { _, metadata } = await c.env.MALACCA_CACHE.getWithMetadata(cacheKeyHex, "stream"); - const contentType = metadata['contentType'] || 'application/octet-stream'; + const { value: _value, metadata } = await c.env.MALACCA_CACHE.getWithMetadata(cacheKeyHex, "stream"); + const contentType = (metadata as Record)['contentType'] || 'application/octet-stream'; c.set('malacca-cache-status', 'hit'); return new Response(response, { headers: { 'malacca-cache-status': 'hit', 'content-type': contentType } }); }