Public
Script
1
2
3
4
5
6
7
8
9
10
11
12
13
import { getInflight } from "https://esm.town/v/tmcw/getInflight";
import { InflightCookies } from "https://esm.town/v/tmcw/InflightCookies";
import { Context } from "npm:hono@3.8.1";
import { getCookie as _getCookie, setCookie as _setCookie } from "npm:hono@3.8.1/cookie";
/** Get a cookie from the request or optionally from inflight */
export function getCookie(c: Context, key: string): string | undefined {
const inflight = getInflight(c);
if (inflight.has(key)) {
return inflight.get(key);
}
return _getCookie(c, key);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
November 16, 2023