Skip to content

feat(api): Read Sentry's list headers and keep Link targets - #131242

Merged
BYK merged 1 commit into
masterfrom
feat/api-response-headers
Nov 16, 2026
Merged

BYK merged 1 commit into
masterfrom
feat/api-response-headers

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Part of #131203.

Sentry list endpoints return more than cursors in their headers, and right now every consumer reads them by hand. This adds two helpers to the root entry.

  • readSentryResponseHeaders(headers) returns { link?, hits?, maxHits?, directHit }. X-Hits and X-Max-Hits come back as numbers and are omitted when missing or not a non-negative integer, instead of NaN. X-Sentry-Direct-Hit: 1 becomes directHit: true. The backend sets it when an ID lookup, such as an event ID or short ID search, finds exactly one item.
  • parseSentryLinks(header) parses Link by rel and keeps each target's href, its results flag (true, false, or null when absent) and its cursor. A UI can then tell an empty previous page from a missing one, or follow the server's next-page URL.

parseSentryLinkHeader now shares the parser and returns the same cursors as before. Nothing existing changes.

via @BYK.

--

View Session [Sentry]

Add readSentryResponseHeaders, which reads Link, X-Hits and X-Max-Hits
as numbers, and X-Sentry-Direct-Hit as a boolean. Add parseSentryLinks,
which parses Link by rel and keeps each target's href and results flag
with its cursor. parseSentryLinkHeader shares its parser and still
returns only the usable cursors.

Co-Authored-By: BYK <[email protected]>
@sentry-junior
sentry-junior Bot requested review from a team as code owners November 16, 2026 13:50
@sentry-junior
sentry-junior Bot requested a review from BYK November 16, 2026 13:50
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 16, 2026
@BYK
BYK merged commit 3931514 into master Nov 16, 2026
88 checks passed
@BYK
BYK deleted the feat/api-response-headers branch November 16, 2026 13:58

This branch was successfully deployed

1 active deployment
Preview — 9b003b33 Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant