Merge pull request #8 from QuixThe2nd/main

Update cloudflare worker.js
This commit is contained in:
Omar Najjar 2025-03-31 17:22:35 +11:00 committed by GitHub
commit ffe15f4884
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -979,14 +979,15 @@ function handleOptions() {
}
// Helper to create standardized responses
function createResponse(body, status = 200, shouldCache = false, cacheDuration = 300) {
function createResponse(body, status = 200, cacheDuration = 60*60*24) {
const headers = {
'Content-Type': 'application/json',
...corsHeaders
};
if (shouldCache) {
if (cacheDuration > 0) {
headers['Cache-Control'] = `public, max-age=${cacheDuration}`;
headers['CDN-Cache-Control'] = `public, max-age=${cacheDuration}`;
} else {
headers['Cache-Control'] = 'no-store';
}