Skip to content

test: Add integration tests for ETag caching on /api/apis - #1049

Merged
greatest0fallt1me merged 1 commit into
CalloraOrg:mainfrom
Immaculate0606:feature/issue-735-etag-apis
Jul 29, 2026
Merged

test: Add integration tests for ETag caching on /api/apis#1049
greatest0fallt1me merged 1 commit into
CalloraOrg:mainfrom
Immaculate0606:feature/issue-735-etag-apis

Conversation

@Immaculate0606

Copy link
Copy Markdown
Contributor

Description:

Closes #735

Description

This PR verifies the implementation of strong ETag and 304 Not Modified caching mechanisms on the public API endpoints (GET /api/apis and GET /api/apis/:id), cutting down bandwidth overhead on repeat reads.

The etagMiddleware logic is already integrated correctly into the route handlers; this PR finalizes the implementation by guaranteeing end-to-end coverage for the specified behaviors.

Changes

  • Added End-to-End ETag Coverage (tests/integration/apis.test.ts):
    • GET /api/apis: Asserts that an initial request generates a 200 OK along with a strong SHA-256 ETag. Submitting this same ETag in an If-None-Match header on subsequent requests now asserts that a 304 Not Modified is correctly intercepted and returned without a body.
    • GET /api/apis/:id: Adds equivalent assertions for the detailed view endpoint, confirming that specific API entity reads also support strong caching validations and appropriately bypass the body payload on cache hits.
    • Cache Miss Handling: Asserts that sending a mismatched ETag gracefully falls back to generating a fresh 200 OK response.

Testing Instructions

  1. Run npm run test -- tests/integration/apis.test.ts to execute the integration suite.
  2. Verify that all ETag Caching sub-tests pass successfully.

@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@Immaculate0606 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 e65c773 into CalloraOrg:main Jul 29, 2026
@greatest0fallt1me

Copy link
Copy Markdown
Contributor

LGTM — clean diff and clear commits. Thanks!

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/apis

2 participants