(domains: string[])
| 41 | } |
| 42 | |
| 43 | async function getAllCookies(domains: string[]) { |
| 44 | const allCookies: Record<string, string> = Object.create(null); |
| 45 | const allSetCookies: Record<string, string[]> = Object.create(null); |
| 46 | |
| 47 | for (const domain of domains) { |
| 48 | const setCookies = await getSetCookies(domain); |
| 49 | if (!setCookies.length) continue; |
| 50 | |
| 51 | const cookies = toCookies(setCookies); |
| 52 | allCookies[domain] = cookies.map(obfuscate).join("; "); |
| 53 | allSetCookies[domain] = setCookies.map((header, index) => { |
| 54 | const attrs = header.split(";"); |
| 55 | return [obfuscate(attrs.shift() || "", index), ...attrs].join("; "); |
| 56 | }); |
| 57 | } |
| 58 | |
| 59 | return [allCookies, allSetCookies] as const; |
| 60 | } |
| 61 | |
| 62 | async function getSetCookies(domain: string) { |
| 63 | const href = url.format({ hostname: domain, protocol: "http" }); |
no test coverage detected
searching dependent graphs…