🧩 Background
app/api/streak/route.ts and app/api/github/route.ts both compute Cache-Control header strings inline using similar ternary expressions.
🎯 Objective
Create utils/cacheControl.ts exporting buildCacheControlHeader({ refresh, random, secondsToMidnight }): string.
📁 Files to touch
utils/cacheControl.ts (new)
app/api/streak/route.ts
app/api/github/route.ts
🛠️ Implementation steps
- Define the helper.
- Add unit tests for all three branches (no-cache, no-store, s-maxage).
- Use from both routes.
✅ Definition of done
🧩 Background
app/api/streak/route.tsandapp/api/github/route.tsboth computeCache-Controlheader strings inline using similar ternary expressions.🎯 Objective
Create
utils/cacheControl.tsexportingbuildCacheControlHeader({ refresh, random, secondsToMidnight }): string.📁 Files to touch
utils/cacheControl.ts(new)app/api/streak/route.tsapp/api/github/route.ts🛠️ Implementation steps
✅ Definition of done