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