Skip to content
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

setCookie not accept ServerResponse and got a typescript type error #123

Closed
csvwolf opened this issue May 24, 2022 · 2 comments
Closed

setCookie not accept ServerResponse and got a typescript type error #123

csvwolf opened this issue May 24, 2022 · 2 comments

Comments

@csvwolf
Copy link

csvwolf commented May 24, 2022

In the version, response is removed: b285659

setCookie(res, name, value, opts?)

cant be called in middleware since:

declare type Middleware = (req: IncomingMessage, res: ServerResponse, next: (err?: Error) => any) => any;

( but if I set the type as any, it works)

What's the reason for removing ServerResponse for the api?

@NozomuIkuta
Copy link
Member

@csvwolf

h3 has not yet reached to stable version (i.e. v1), so breaking changes are likely to be introduced even in minor updates.

As far as I see, your issue results from #73.

You also might want to check a author's comment, which says that req/res style middleware has been deprecated.

@pi0
Copy link
Member

pi0 commented Oct 18, 2022

You should pass event as first argument to all h3 utils, setCookie(event, ...)

@pi0 pi0 closed this as completed Oct 18, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants