Skip to content

feat(api): Add ETag / 304 caching on /api/maintenance - #1022

Merged
greatest0fallt1me merged 3 commits into
CalloraOrg:mainfrom
kosisochukwu1234:feature/etag-caching-maintenance
Jul 29, 2026
Merged

feat(api): Add ETag / 304 caching on /api/maintenance#1022
greatest0fallt1me merged 3 commits into
CalloraOrg:mainfrom
kosisochukwu1234:feature/etag-caching-maintenance

Conversation

@kosisochukwu1234

Copy link
Copy Markdown
Contributor

Closes #886

This PR addresses the backend issue for the GrantFox FWC26 campaign. It introduces strong ETag generation and HTTP 304 Not Modified support for the public-facing /api/maintenance endpoint.

Previously, the endpoint returned a full 200 OK response along with the payload every time it was polled. With this update, we emit a strong SHA-256 ETag corresponding to the response payload. By honoring the If-None-Match header in subsequent client requests, we cut down bandwidth significantly on repeat reads, meeting the campaign's high-traffic performance needs.

Changes Included

  • Middleware Integration: Added etagMiddleware to the publicMaintenanceRouter in src/routes/maintenance.ts.
  • Documentation: Updated the JSDoc comments in src/routes/maintenance.ts to document the new ETag generation and caching behavior, making the API/visible changes clear to other contributors.
  • Testing:
    • Added targeted integration test suites in src/routes/maintenance.test.ts under describe('ETag / 304 caching (issue #021)').
    • Verified that a strong ETag is present on first requests.
    • Verified that requests carrying a matching If-None-Match correctly short-circuit and return 304 Not Modified with an empty body and stripped content headers.
    • Verified that mismatched If-None-Match strings correctly fall back to a standard 200 OK response.

Security & Reliability

  • Validated that the CORS allowance is strictly honored alongside the caching mechanism.
  • Kept dependencies unchanged.
  • Adhered to the existing repository code style and lint rules.

@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@kosisochukwu1234 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

@greatest0fallt1me
greatest0fallt1me merged commit b281365 into CalloraOrg:main Jul 29, 2026
1 check passed
@greatest0fallt1me

Copy link
Copy Markdown
Contributor

All checks green — merging. Nice job! 🚀

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 ETag / 304 caching on /api/maintenance [b#021]

2 participants