Answer prose round 1: 0 🔴, 3 🟡 (0 misread); comments shortened, README file map lists link-header
CI / full-gate (push) Successful in 3m27s

This commit is contained in:
2026-11-09 01:25:14 +01:00
parent c9485631c8
commit 5a5ce5499d
3 changed files with 4 additions and 7 deletions
+2 -3
View File
@@ -1,6 +1,5 @@
// Kratos and Hydra both paginate with an RFC 8288 `Link` header. Returns the `page_token` of its
// `rel="next"` entry, or null on the last page. The href is a relative path, so it is resolved
// against a throwaway base just to read the query parameter.
// The `page_token` of a `Link` header's `rel="next"` entry (Kratos and Hydra paginate with it), or
// null when there is none. The href is relative, so it is resolved against a throwaway base.
export function nextPageToken(link: string | null): string | null {
const href = link?.match(/<([^>]+)>\s*;\s*rel="next"/)?.[1];
return href ? new URL(href, "http://link-header.invalid").searchParams.get("page_token") : null;