MCPcopy Create free account
hub / github.com/jshttp/cookie / getAllCookies

Function getAllCookies

scripts/update-benchmark.ts:43–60  ·  view source on GitHub ↗
(domains: string[])

Source from the content-addressed store, hash-verified

41}
42
43async 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
62async function getSetCookies(domain: string) {
63 const href = url.format({ hostname: domain, protocol: "http" });

Callers 1

mainFunction · 0.85

Calls 3

getSetCookiesFunction · 0.85
toCookiesFunction · 0.85
obfuscateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…