-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v2 migration #787
Comments
Why did you stop using |
@AaronDewes mainly for bundle size. But i am up to add a replacement util for safe read (#819, feel free to make a PR for it!) |
What would you think of the following approach to handle defineEventHandler({
handler(...),
// Here response type would always be Response
onBeforeResponse(event, response: Response) {
// We can then edit the response headers
response.headers.set('X', 'Y');
// Or even return a new one?
return new Response(...);
}
});
// Another approach: Update EventHandler definition so that we can return a Response Handler
defineEventHandler(event => {
// return a Response handler
return (response: Response) => {
response.headers.set('X', 'Y');
return response;
}
}); The benefits I see are:
|
@magne4000 With #829 h3 will be web-first with |
Note
This is a tracker issue for H3 v2 release. You can try with
h3-nightly@2x
Migration guide:
The text was updated successfully, but these errors were encountered: