Closed wesleytodd closed 7 years ago
The test failure seems to be a broken integration with sauce labs, not because of this addition.
It's indeed not possible to remove unknown cookies using the current API. I agree it makes sense allow retrieval of all cookies to support these kind of advanced use cases. Perhaps it's even justified to introduce a new dedicated method such as cookies.all()
.
Due to security reasons Sauce Labs is not allowed on pull requests, but your test code passed the local (PhantomJS) test on travis so it seems fine. I'll make sure to add some bad weather test cases such as handling of falsey cookies names.
Note that the current framework that's used to run the unit tests on Sauce Labs has gotten unreliable, so this is something I will need to fix first.
I am fine with changing it to cookies.all()
if that is what you would rather have. Not sure if one is objectivly better than the other, but its your lib :)
Let me know what you would prefer and I can update the PR.
I like the cleverness of returning all cookies when no name is specified, however after some thought I've decided I prefer using cookies.all()
because it's more explicit which improves code readability and eases referencing to this new functionality in the documentation/examples sections.
Changes made
Do you have a estimate for when you will be ready to publish these changes to npm?
I shall publish the new release (v1.1.0) to npm this weekend
Use case:
I need to remove an unknown set of cookies and want to leverage this module's cookie parsing instead of parsing it myself and then calling
cookies.erase
for each. This would allow me to do the following:Resulting in just
foo
andbar
remaining. Make sense?