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

Adding res.cookie and res.clearCookie in API Routes #7923

Closed
hoangvvo opened this issue Jul 12, 2019 · 2 comments
Closed

Adding res.cookie and res.clearCookie in API Routes #7923

hoangvvo opened this issue Jul 12, 2019 · 2 comments

Comments

@hoangvvo
Copy link

@hoangvvo hoangvvo commented Jul 12, 2019

Feature request

Is your feature request related to a problem? Please describe.

Having res.cookie and res.clearCookie helper function makes it easier to manipulate cookies in response.

Describe the solution you'd like

Implementing ExpressJS-like res.cookie and res.clearCookie

Describe alternatives you've considered

Using http.ServerResponse response.setHeader(name, value)

Additional context

If this is not possible, how can I implement my own res.cookie and res.clearCookie using middlewares?

@zorrme

This comment has been minimized.

Copy link

@zorrme zorrme commented Jul 12, 2019

It will be nice if we are able to use express middleware.

@hoangvvo

This comment has been minimized.

Copy link
Author

@hoangvvo hoangvvo commented Jul 18, 2019

I'm closing this issue as it has been solved using Middleware. Thanks @huv1k for that.

api-routes-middleware

Still, I wish we include it in the core of API Routes since we have already has req.cookies anyway. But I understand that it may make API Routes too opinionated.

@hoangvvo hoangvvo closed this Jul 18, 2019
@Timer Timer modified the milestones: 9.0.x, 9.0.3 Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.