-
Notifications
You must be signed in to change notification settings - Fork 38k
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
Add support for adding cookies as headers in MockHttpServletResponse [SPR-17110] #21647
Comments
Vedran Pavic commented Updated issue with Pull Request URL. |
Rossen Stoyanchev commented Since |
Vedran Pavic commented Thanks for the feedback Rossen. I agree that the custom I'll pick this up, and update the PR over the next day or two. |
Rossen Stoyanchev commented Okay sounds good. |
Vedran Pavic commented I've updated the PR - Rossen Stoyanchev please take a look when you can and let me know if the direction is good. |
Rossen Stoyanchev commented Hm do we need the parsing? What about enhancing addCookie and getCookieHeader to detect MockCookie and also append sameSite to the header value? Is this because the code under test sets the header directly? |
Vedran Pavic commented Yes, it is because the cookie is being set as a I went with I see your point on enhancing |
Vedran Pavic commented I've updated the PR with |
Michael Bell commented Introduces regression due to bad parse method in MockCookie - see #21854 |
Vedran Pavic opened SPR-17110 and commented
Adding cookies that contain directives that aren't directly supported in Servlet API, such as
SameSite
for example, requires writing cookie directly usingHttpServletResponse#addHeader
, instead of commonly usedHttpServletResponse#addCookie
.As
MockHttpServletResponse
doesn't have any special treatment forSet-Cookie
header (i.e. doesn't parse and add cookies that were added directly as headers), testing of code that writes cookies in the manner described above is quite a painful experience.Affects: 4.3.18, 5.0.8, 5.1 RC1
Issue Links:
Referenced from: pull request #1913, and commits bb2db87
The text was updated successfully, but these errors were encountered: