-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Some cookies cannot be removed with jar.delete() or jar.clear() #3026
Comments
Update: const jar = http.CookieJar();
const params = {
"headers": {
"Content-Type": "application/json",
"Accept-API-Version": "resource=2.1, protocol=1.0"
},
"jar": jar
};
const req = http.post(url + "?authIndexType=service&authIndexValue=authn-web-v4", {}, params); I still think the jar.delete() is not working as expected, but this is a reasonable workaround. |
Hi there, thanks for opening this issue, and for the detailed explanation and script ❤️ I'm able to reproduce it with your script and example URL, and like you said, it doesn't happen on other sites (e.g. https://httpbin.test.k6.io/). I was also able to reproduce it with a custom endpoint. It happens if the URL contains a nested path, i.e. more than one I'm still looking into why this is the case, and will update this issue, and hopefully push a fix once I figure it out. This won't make it in the upcoming v0.44.0 release this Monday, but will be part of the next release. |
OK, so after a bit more reading and testing, I now think k6 is behaving as expected. Here are the headers sent by
Notice the Yet when you call Instead, you should call So you'll need to inspect the Let me know if this resolves it, and please close the issue if so. |
Thank you for the really fast and accurate response. I confirm the solution is to use 'scheme+host+cookie path', instead of the full URL. Thanks! |
Brief summary
We have a scenario where we must remove cookies from the request. However, it seems a specific cookie cannot be removed.
Code snippet:
Output:
After that, a request still sends the cookie (full code below).
I've tried to reproduce with other (httpOnly, secure) cookie-websites, but I didn't manage, so it has something to do with this URL.
Can you explain why this is not working? Is it something in my code, or are there scenario's where cookies just cannot be removed?
k6 version
v0.43.1
OS
Arch Linux
Docker version and image (if applicable)
20.10.24, build 297e128
Steps to reproduce the problem
Run this code:
Expected behaviour
The check passes twice, indicating that the amlbcookie cookie is not part of the (second) request.
Or, if the cookie for some reason cannot be removed, I would like to see some feedback from K6 with the reason of this behavior.
Actual behaviour
The check fails the second time, because the cookie is not deleted and the cookieJar is not cleared. Without an indication from K6 if this failure.
Output:
The workaround is to override the request cookie with an empty one with the same name, but this is not optimal.
The text was updated successfully, but these errors were encountered: