MCPcopy
hub / github.com/lissy93/web-check / cookieHandler

Function cookieHandler

api/cookies.js:24–48  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

22};
23
24const cookieHandler = async (url) => {
25 let headerCookies = null;
26 let clientCookies = null;
27
28 try {
29 const response = await httpGet(url);
30 headerCookies = response.headers['set-cookie'];
31 } catch (error) {
32 if (error.response) {
33 return { error: `Request failed with status ${error.response.status}: ${error.message}` };
34 }
35 return { error: `No response received: ${error.message}` };
36 }
37
38 try {
39 clientCookies = await getPuppeteerCookies(url);
40 } catch (_) {
41 clientCookies = null;
42 }
43
44 return {
45 headerCookies: headerCookies || [],
46 clientCookies: clientCookies || [],
47 };
48};
49
50export const handler = middleware(cookieHandler);
51export default handler;

Callers

nothing calls this directly

Calls 2

httpGetFunction · 0.90
getPuppeteerCookiesFunction · 0.85

Tested by

no test coverage detected