diff --git a/src/fetch.ts b/src/fetch.ts index 73d14bf..ecd8385 100644 --- a/src/fetch.ts +++ b/src/fetch.ts @@ -150,8 +150,14 @@ export const fetchUsingGuest = async ( } /* If we've generated a new token, we'll cache it */ if (event && newTokenGenerated) { + const cachingResponse = new Response(await activate.clone().text(), { + headers: { + ...tokenHeaders, + 'cache-control': 'max-age=300' + } + }); console.log('Caching guest token'); - event.waitUntil(cache.put(guestTokenRequestCacheDummy, activate.clone())); + event.waitUntil(cache.put(guestTokenRequestCacheDummy, cachingResponse)); } conversation.guestToken = guestToken; return conversation;