-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat(cookies): filter expired cookies when injected in httpClient #1165
Comments
@davinkevin yes we probably don't handle cookie expiration correctly, but no one else has raised this either. see if you can use this as a reference, someone had created a great example for fixing a similar issue in the past: #552 would be great if you can submit a PR, but if you submit an example, that would increase the likelihood of this getting fixed sooner ! |
Thank for the answer, I will try to see if I can provide a PR for example project and/or a PR for this. |
moving to project board: https://github.com/intuit/karate/projects/3#card-41317122 |
Hi @ptrthomas - if its ok can I pls pick this? I tried to request this from project board proposed column - couldnt find anything to request? Let me know, Thank you |
@chaudharydeepak yes go ahead |
Thank you @ptrthomas - I quickly glanced through code base Actually we simply need to set the expiration date - and internal implementation will take care of rest. Secondly, we can make this configurable - just to ensure if there any possible use case where users might want to push through an expired cookie - can't think of any feasible usecase - but just to keep it flexible. Please let me know your inputs and will go make changes accordingly. Thank you. |
lets not do configuration for now, user can always manually send a cookie |
@ptrthomas - I verified that as long as expiration date is set on the cookie - apache CookieStore takes care of removing any expired cookies before making a request - so I think we should be good there - i wrote some simple tests for ApacheHttpClient to verify. Will validate for Jersey Client and testing with demo server too. |
@ptrthomas - just to keep you posted - `Scenario: expired cookie is not in response Scenario: non-expired cookie is in response Additionally I had trouble setting cookie expiration as #And param expires = 'Wed, 07 Oct 2020 14:43:04 GMT', so I added it to cookie json request - I will do some more testing - let me know if you have any feedback. Thank you. |
@chaudharydeepak thanks. you can try for jersey - but worst case you can use a tag |
#1165 - filter expired cookies when injected in httpClient
I'm closing this issue because the code is completely rewritten. @chaudharydeepak did a great job implementing expiry checks but after some back and forth, I've decided that as a testing framework, users may want to send invalid cookies to the server to see how it behaves. the next version has no cookie checks at all, users can send whatever they want |
I've read a part of the karate code and, if I'm right, Karate doesn't support expiration time for cookies.
The problem is when Karate is sending a cookie, it doesn't verify if it is expired or not and sends all cookies previously set (especially those set by a previous request with an
EXPIRES
parameter).In the following logs, the log time is in GMT+2 (🇫🇷).
You can see a "wait" in the middle of this execution, and the only cookie set is already expired but still send in the last request.
I've read all I can do about cookies in karate documentation and code (especially here and here and I don't see any references to
Expires
filer inside this usage of cookies.BTW, the key
com.intuit.karate.http.Cookie.EXPIRES
when cookies are fetched from a response and nowhere else.I didn't provide a code example because I think this is a feature request and not a bug. If you need I will be able to provide one, but it's time-consuming to have a demo backend to demonstrate the use case.
The text was updated successfully, but these errors were encountered: