import {parse} from "cookie"; export default { async fetch(request): Promise { // The name of the cookie const COOKIE_NAME = "session"; const cookie = parse(request.headers.get("Cookie") || ""); if (cookie[COOKIE_NAME] != null) { // Respond with the cookie value return new Response(`

Cookie Status

Cookie '${COOKIE_NAME}' exists with value: ${cookie[COOKIE_NAME]}

`, { headers: { "Content-Type": "text/html" } }); } return new Response(`

Cookie Status

No cookie found ith name: ${COOKIE_NAME}

`, { headers: { "Content-Type": "text/html" } }); }, } satisfies ExportedHandler;