frandiox / vitedge

Edge-side rendering and fullstack Vite framework
https://vitedge.js.org
MIT License
732 stars 31 forks source link

Get Cookies Headers during vitedge initializatio script #91

Closed oleghalin closed 2 years ago

oleghalin commented 2 years ago

Hello. I'm trying to set i18n locale on the server-side, to do so I need to get the locale cookie from Request Headers. How can i access it in vitedge callback?

image
frandiox commented 2 years ago

Hi! You should be able to get the request object in the main hook: export default vitedge(App, {...}, (context) => { context.request; ... });

oleghalin commented 2 years ago
image
oleghalin commented 2 years ago

And console displays undefined

oleghalin commented 2 years ago
image

And looks like types doesn't have it too.