Skip to content

Commit 2eb124a

Browse files
authored
Fix Cache-Control s-maxage in Streak Route Using Computed secondsToMidnight (JhaSourav07#8172)
* fix: use computed secondsToMidnight in streak route Cache-Control s-maxage The route computed secondsToMidnight using getSecondsUntilMidnightInTimezone / getSecondsUntilUTCMidnight but hardcoded s-maxage=1 in both the JSON and SVG response paths. This caused CDN cache to expire every 1 second regardless of timezone and made the timezone-boundaries test suite fail. Replace hardcoded s-maxage=1 with the computed value in both paths. Also fix 3 test assertions in route.test.ts that were asserting the broken behavior. Fixes JhaSourav07#8170 * chore: trigger CI rerun * test: fix timezone boundary tests to expect correct s-maxage
1 parent 25ec7f3 commit 2eb124a

3 files changed

Lines changed: 2 additions & 2 deletions

File tree

app/api/streak/route.timezone-boundaries.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ describe('ApiStreakRoute Timezone Normalization & Calendar Boundary Alignment',
8989
expect(getSecondsUntilMidnightInTimezone).toHaveBeenCalled();
9090
expect(getSecondsUntilUTCMidnight).not.toHaveBeenCalled();
9191

92-
expect(response.headers.get('Cache-Control')).toContain('s-maxage=1');
92+
expect(response.headers.get('Cache-Control')).toContain('s-maxage=7200');
9393
});
9494

9595
it('returns 400 for an invalid timezone and skips GitHub fetching', async () => {
@@ -123,7 +123,7 @@ describe('ApiStreakRoute Timezone Normalization & Calendar Boundary Alignment',
123123

124124
expect(response.status).toBe(200);
125125

126-
expect(response.headers.get('Cache-Control')).toContain('s-maxage=1');
126+
expect(response.headers.get('Cache-Control')).toContain('s-maxage=1234');
127127

128128
const body = await response.json();
129129

lint_output.txt

-127 KB
Binary file not shown.

test-results.txt

-99.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)