(header: string | null)
| 74 | } |
| 75 | |
| 76 | export function parseLinkHeader(header: string | null) { |
| 77 | if (!header) { |
| 78 | return {}; |
| 79 | } |
| 80 | return flow([ |
| 81 | linksString => linksString.split(','), |
| 82 | map((str: string) => str.trim().split(';')), |
| 83 | map(([linkStr, keyStr]) => [ |
| 84 | keyStr.match(/rel="(.*?)"/)[1], |
| 85 | linkStr |
| 86 | .trim() |
| 87 | .match(/<(.*?)>/)[1] |
| 88 | .replace(/\+/g, '%20'), |
| 89 | ]), |
| 90 | fromPairs, |
| 91 | ])(header); |
| 92 | } |
| 93 | |
| 94 | export async function getAllResponses( |
| 95 | url: string, |
no test coverage detected