import Koa from "koa"; import bodyParser from "koa-bodyparser"; const app = new Koa(); app.use(bodyParser()); app.use(async (ctx) => { if (ctx.request.method === "POST") { const { cookie } = ctx.request.body as { cookie: string }; ctx.cookies.set("cookie", cookie); ctx.redirect( "/"); } else { ctx.body = `
${JSON.stringify(Object.fromEntries(Object.entries(ctx.request.headers)), null, 2)}