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

Have a way to get all cookie names #52

Open
joeyespo opened this issue Aug 4, 2014 · 10 comments
Open

Have a way to get all cookie names #52

joeyespo opened this issue Aug 4, 2014 · 10 comments

Comments

@joeyespo
Copy link

joeyespo commented Aug 4, 2014

This library is wonderful for getting and setting individual cookies. I have a case where I need to get all cookies though.

It'd be nice to just re-use the get() function without specifying a key:

var cookies = new Cookies(req, res, keys);
var allCookies = cookies.get();

Thanks for your hard work!

@jonathanong
Copy link
Member

This isn't really the purpose of this module. but I think we should be able to do .names() or something to get all the cookie names.

@joeyespo
Copy link
Author

joeyespo commented Aug 4, 2014

@jonathanong Sure. Working with cookies in Node has just been a very fragmented experience. This would help smooth it out a bit.

@jonathanong jonathanong changed the title Have a way to get all cookies Have a way to get all cookie names Aug 4, 2014
@jonathanong jonathanong added bug and removed bug labels Aug 4, 2014
@tonyxiao
Copy link

is there a workaround for this issue?

@dougwilson
Copy link
Contributor

dougwilson commented Sep 12, 2016

No workaround unless you parse the header yourself, at which point you're probably just not using this module. If someone makes a PR, we can take a look.

@House3272
Copy link

Has there been any progress on implementing this feature?

@dougwilson
Copy link
Contributor

No PR has been submitted yet, so I assume no.

@shri3k
Copy link

shri3k commented Jun 16, 2017

Correct me if I'm wrong but wouldn't the PR just be adding

if (!name) return header

in this line? or I might have misunderstood on what is being requested.

@shri3k
Copy link

shri3k commented Jun 24, 2017

@dougwilson would you be interested in a PR with the above changes (with tests/docs update too of course)?

@creeperyang
Copy link

creeperyang commented Aug 8, 2017

@shri3k No, the header here is just raw cookie string.

The express cookie middleware will parse the entire cookie string and generate the all cookie object.

Can we do this too? Such as when call ctx.cookie.get(name) first time, we parse the entire cookie string to the object and cache it.

@Rimin
Copy link

Rimin commented Oct 9, 2021

i also want to get all cookies; it would be good if support;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants