auth-yes/scratch/hono_cookie_test.ts
google-labs-jules[bot] 947b38d81a Investigate mobile login cookie persistence bug
- Investigated Chromium Android wildcard domain cookie behavior.
- Researched Hono's `getCookie` first-match parsing behavior.
- Added experimental Deno test scripts in `scratch/` for Hono cookie header parsing and pg timezone concepts.
- Wrote full root-cause analysis and ranked architectural solutions in `scratch/INVESTIGATIVE_REPORT.md`.

Co-authored-by: mrteye <1945243+mrteye@users.noreply.github.com>
2026-08-25 00:31:19 +00:00

39 lines
862 B
TypeScript

import { Hono } from "jsr:@hono/hono@4";
import { getCookie } from "jsr:@hono/hono@4/cookie";
const app = new Hono();
app.get('/', (c) => {
const sessionId = getCookie(c, "session_id");
const allCookies = c.req.header("cookie");
return c.json({
parsedSessionId: sessionId,
rawCookieHeader: allCookies
});
});
const req1 = new Request("http://localhost/", {
headers: {
"Cookie": "session_id=first-uuid; session_id=second-uuid"
}
});
const req2 = new Request("http://localhost/", {
headers: {
"cookie": "session_id=first-uuid; other=123"
}
});
async function run() {
console.log("Test 1: Multiple session_id cookies");
const res1 = await app.fetch(req1);
console.log(await res1.json());
console.log("Test 2: Lowercase cookie header");
const res2 = await app.fetch(req2);
console.log(await res2.json());
}
run();