Fix the parsing of pagination link querystrings (#2366)

This commit is contained in:
Justin Dalrymple 2022-02-07 10:57:37 -05:00 committed by GitHub
parent 531758c6db
commit a70b66a467
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,7 +119,9 @@ async function getHelper<P extends 'keyset' | 'offset', E extends boolean>(
// Handle array responses
const newAcc = [...acc, ...body];
const { next }: { next: string } = parseLink(headers.link);
const { query: qs = {} } = next ? parseQueryString(next, { parseNumbers: true }) : {};
const { query: qs = {} } = next
? parseQueryString(next, { parseNumbers: true, arrayFormat: 'bracket' })
: {};
const withinBounds = maxPages
? newAcc.length / ((qs.per_page as unknown as number) || 20) < maxPages
: true;