MCPcopy Create free account
hub / github.com/getsentry/sentry / parseLinkHeader

Function parseLinkHeader

static/app/utils/parseLinkHeader.tsx:8–33  ·  view source on GitHub ↗
(header: string | null)

Source from the content-addressed store, hash-verified

6type Result = Record<string, ParsedHeader>;
7
8export function parseLinkHeader(header: string | null): Result {
9 if (header === null || header === '') {
10 return {};
11 }
12
13 const headerValues = header.split(',');
14 const links: Record<string, ParsedHeader> = {};
15
16 headerValues.forEach(val => {
17 const match =
18 /<([^>]+)>; rel="([^"]+)"(?:; results="([^"]+)")?(?:; cursor="([^"]+)")?/.exec(val);
19 if (!match) {
20 return;
21 }
22 const [, href, rel, results, cursor] = match;
23 const hasResults = results === 'true' ? true : results === 'false' ? false : null;
24
25 links[rel!] = {
26 href: href!,
27 results: hasResults,
28 cursor: cursor!,
29 };
30 });
31
32 return links;
33}

Callers 15

fetchRegionPagesFunction · 0.90
ResultGridFunction · 0.90
ViewerTableV2Function · 0.90
PaginationFunction · 0.90
fetchDataMethod · 0.90
fetchProjectsFunction · 0.90
fetchProjectsFunction · 0.90
fetchTeamsFunction · 0.90
pollMethod · 0.90
useReplayDataFunction · 0.90
parsePageParamFunction · 0.90

Calls 2

splitMethod · 0.80
forEachMethod · 0.80

Tested by

no test coverage detected