Skip to content

feat: add differentiated Cache-Control headers to stream list responses#273

Open
devEunicee wants to merge 1 commit into
Fluxora-Org:mainfrom
devEunicee:feature/streams-cache-control-headers
Open

feat: add differentiated Cache-Control headers to stream list responses#273
devEunicee wants to merge 1 commit into
Fluxora-Org:mainfrom
devEunicee:feature/streams-cache-control-headers

Conversation

@devEunicee
Copy link
Copy Markdown

Summary

Sets differentiated Cache-Control headers on GET /api/streams and GET /api/streams/:id based on the mutability of the returned stream data.

Changes

  • src/streams/status.ts — add isTerminalStatus(status: ApiStreamStatus): boolean helper
  • src/routes/streams.ts — derive and set Cache-Control before res.json in both GET handlers
  • tests/routes/streams.cacheControl.test.ts — 12 tests (all passing): active/paused/scheduled → no-store, completed/cancelled → cacheable, mixed page → no-store, empty page → cacheable
  • docs/api.md — document caching behaviour per stream status

Cache-Control logic

Condition Header
Any stream is active, paused, or scheduled private, no-store
All streams are completed or cancelled public, max-age=300, stale-while-revalidate=60
Empty page public, max-age=300, stale-while-revalidate=60

Terminal streams are immutable — safe to cache at the edge. Non-terminal streams carry live financial state that changes continuously and must not be stored by shared caches.

Test results

Closes #234

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@devEunicee Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Cache-Control headers to GET /api/streams list responses

1 participant