## Demo: cookie-vary-test ### CookieVaryTest.svelte ```svelte Check the response headers: Vary: Cookie is set by the route handle. ``` ### routes.ts ```ts import { Mochi } from 'mochi-framework'; import type { Handle, MochiRouteValue } from 'mochi-framework'; export const routes: Record = { '/cookie-vary-test': Mochi.page('./src/demos/cookie-vary-test/CookieVaryTest.svelte'), }; export const handle: Handle = async ({ event, resolve }) => { const response = await resolve(event); if (event.url.pathname === '/cookie-vary-test' || event.url.pathname === '/cookie-vary-test/') { response.headers.set('Vary', 'Cookie'); } return response; }; ``` ### index.ts ```ts import { Mochi, logger } from 'mochi-framework'; import { routes } from './routes'; await Mochi.serve({ port: 3333, development: process.env.MODE === 'development', routes, }); logger.info('Server running at http://localhost:3333'); ```
Check the response headers: Vary: Cookie is set by the route handle.
Vary: Cookie