-
Notifications
You must be signed in to change notification settings - Fork 68
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
.remove does not remove cookies set on specific paths. #32
Comments
Basically, it just sets the cookie's value to blank with an empty options object (by default) and then an expiration of -1. I extracted my set functionality into a service and then just pass into the set an empty string, so it'll use the same set of options exactly. |
Yes, this is not the behavior I expected :( |
.remove have got nothing to do with paths its not taken care of in the code. cookieFun.remove = function (key, options) {
var hasCookie = cookieFun(key) !== undefined;
if (hasCookie) {
if (!options) {
options = {};
}
options.expires = -1;
cookieFun(key, '', options);
}
return hasCookie;
}; it basically fetches all the cookies and then sets empty on the key of the cookie which we want to delete. |
I've noticed this issue as well. Because it is just setting the cookie value to to empty string, if the PATH and DOMAIN do not match the initial cookie, it will not be overwriting the correct cookie. |
in angular 2 on calling remove all cookies only delete object cookies, the string cookies remain same. no values is over written and expiry is remain unchanged. I observe the issues right after specifying domain with loopback ip address in |
Not sure if this is a feature or a bug, however if I set a cookie with a specific path,
.remove
does not have an effect on it, even doe' returningtrue
.Reproduction steps:
Navigate on a domain with a subpage like: /subpage/
Extra info:
I know about the option
ipCookie.remove('x', { path : '/subpage' })
however I was expecting from the return value of the remove above, to take effect on the/subpage
path as well.The text was updated successfully, but these errors were encountered: