-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Update Cookie headers in MockHttpServletRequest and Response [SPR-15225] #19790
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
Comments
Rossen Stoyanchev commented In the case of The case of cookies is somewhat different. It's a bit more effort to format the cookie as a String. We can certainly do that but I don't think it's worth going as far as being able to parse it from a header to make it symmetrical. So I'd like to double check what the underlying motivation for this is. Purely from a testing perspective checking the cookies should be good enough. If this relates to REST Docs, I can see the value in updating from Cookie -> headers but not the other way around. Also I'm wondering if you care about #19773 which is related. |
Andy Wilkinson commented This does indeed relate to REST Docs. Updating from Cookie -> Headers is where I see the value too. I don't see any value in the other way around either. Sorry if I gave a different impression above. Perhaps something I wrote was ambiguous?
I don't care about it from a REST Docs perspective, but I do from a general consistency of behaviour perspective. I'd welcome all the setters that relate to a header automatically updating the header when they're called. |
Rossen Stoyanchev commented No you didn't ask for it. I was simply clarifying since seeking consistency with content-type handling also implies two way handling between headers and Servlet API types. I was simply making sure that wasn't part of your expectations. |
Andy Wilkinson commented My understanding of RFC-6265 is that there should be a space between the |
Rossen Stoyanchev commented Thanks Andy, should be fixed now. |
Andy Wilkinson opened SPR-15225 and commented
When
setContentType
is called onMockHttpServletRequest
orMockHttpServletResponse
theContent-Type
header is automatically updated. However, whensetCookies
is called onMockHttpServletRequest
oraddCookie
is called onMockHttpServletResponse
the respectiveCookie
andSet-Cookie
headers are unaffected.In the interests of consistency, I'd like
setCookies
andaddCookie
to automatically update theCookie
andSet-Cookie
headers respectively. Setting theCookie
header would also provide an opportunity to apply the recommended ordering:Affects: 4.3.6
Issue Links:
Referenced from: commits 6e71828, e33f603, e5fc40a
The text was updated successfully, but these errors were encountered: