Skip to content

feat: ETag on /api/webhooks - #1358

Open
emmixeryng wants to merge 1 commit into
Streampay-Org:mainfrom
emmixeryng:task/webhooks-etag-v7
Open

feat: ETag on /api/webhooks#1358
emmixeryng wants to merge 1 commit into
Streampay-Org:mainfrom
emmixeryng:task/webhooks-etag-v7

Conversation

@emmixeryng

Copy link
Copy Markdown

Overview

This PR adds strong ETag validators and 304 Not Modified support on GET /api/webhooks (Prometheus metrics scrape), reusing and extending src/middleware/etag.ts with a raw-body helper so the Prometheus Content-Type is preserved.

Related Issue

Closes #1110

Changes

⚡ ETag / 304 on webhooks metrics scrape

  • [MODIFY] app/api/webhooks/route.ts

    • GET returns strong ETag + Cache-Control via withStrongEtagBody
    • Honours If-None-Match → 304
    • Restores missing applyRateLimit import (broken on main after an earlier merge)
  • [MODIFY] src/middleware/etag.ts

    • Adds createStrongEtagFromBody / withStrongEtagBody for non-JSON representations
  • [ADD] app/api/webhooks/webhooks.etag.test.ts

  • [MODIFY] app/api/webhooks/route.test.ts / src/middleware/etag.test.ts

  • [ADD] docs/api/webhooks-etag.md

Verification Results

npm run test -- --testPathPattern='webhooks.etag|middleware/etag\.test|webhooks/route\.test|exports.etag' --no-coverage
✅ webhooks.etag / etag middleware / webhooks route / exports.etag — all passed
Acceptance Criteria Status
Strong ETag on /api/webhooks ✅ SHA-256 strong validator over metrics body bytes
304 when If-None-Match matches ✅ covered by tests (exact tag, list, and *)
Docs updated docs/api/webhooks-etag.md
Tests added and passing ✅ focused + regression green

@drips-wave

drips-wave Bot commented Aug 1, 2026

Copy link
Copy Markdown

@emmixeryng 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 ETag/304 on /api/webhooks (v7)

1 participant