]> git.ardis.lu - ardislu.dev/commitdiff
Remove Cache-Control response header
authorArdis Lu <ardisglu@gmail.com>
Thu, 21 Jul 2022 03:00:00 +0000 (20:00 -0700)
committerArdis Lu <ardisglu@gmail.com>
Thu, 21 Jul 2022 03:00:00 +0000 (20:00 -0700)
This logic is handled by the client-side service worker

functions/api.js

index ed462eb6adacc2b29b8f057db18f4f45191a134f..f6c2fb30d0e90a0b3487b5b8732279acd59ed012 100644 (file)
@@ -11,7 +11,7 @@ export async function onRequestGet({ request, env }) {
 
   const token = await getGoogleAuthToken(env.EMAIL, env.PRIVATE_KEY, env.SCOPES);
 
-  const response = await fetch(queryUrl, {
+  return fetch(queryUrl, {
     cf: {
       cacheEverything: true,
       cacheTtl: 86400
@@ -20,9 +20,4 @@ export async function onRequestGet({ request, env }) {
       Authorization: `Bearer ${token}`
     }
   });
-
-  const newResponse = new Response(response.body, response);
-  newResponse.headers.set('Cache-Control', 'max-age=86400, stale-while-revalidate=604800');
-
-  return newResponse;
 }
This page took 0.040733 seconds and 4 git commands to generate.