Closed vicary closed 7 months ago
Headers are set in so called Handler
functions in Fresh that are executed before any rendering happens. See https://fresh.deno.dev/docs/getting-started/custom-handlers
Note to self: useContext breaks (#983) when exporting defineRoute
with an async callback, while exporting a sync FunctionComponent works.
With
defineRoute
being a really convenient method for type inference, I almost exclusively use this helper method.I found it falls short for pages with forms, where it is supposed to go stale when navigated away, a common practise would be adding
Cache-Control: no-cache, no-store, must-revalidate
.Is it possible to allow custom headers when returning a component from the helper?