Skip to content

Commit

Permalink
Fixed response
Browse files Browse the repository at this point in the history
  • Loading branch information
L480 committed Mar 8, 2024
1 parent ff5beb8 commit 8e0b2c7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions workers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ export default {
}

// JSON response with cache and CORS
const response = new Response(JSON.stringify(allTonies));
response.headers.set('Content-Type', 'application/json');
response.headers.set("Cache-Control", "max-age=" + cacheTtl);
response.headers.set("Access-Control-Allow-Origin", env.CORS_ORIGINS);
return response;
return Response.json(allTonies, {
headers: {
'Cache-Control': 'max-age=' + cacheTtl,
'Access-Control-Allow-Origin': env.CORS_ORIGINS,
'Access-Control-Allow-Methods': 'GET',
}
});
},
};

0 comments on commit 8e0b2c7

Please sign in to comment.