Skip to content
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

MockHttpServletResponse.setLocale(Locale) should set HttpHeaders.CONTENT_LANGUAGE header [SPR-16311] #20858

Closed
spring-issuemaster opened this issue Dec 19, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Dec 19, 2017

Dmitry Katsubo opened SPR-16311 and commented

As to my interpretation of ServletResponse#setLocale() JavaDoc which reads:

In the case of HTTP, the locale is communicated via the Content-Language header, the character encoding as part of the Content-Type header for text media types.

the corresponding implementation should set HttpHeaders.CONTENT_LANGUAGE which specifies the "language" of response content. Currently it sets HttpHeaders.ACCEPT_LANGUAGE, which is "language that client understands / prefers" - that one should be set by the client when it makes a request.

See also:


Affects: 5.0.1

Issue Links:

  • #19773 Mock MVC / RequestBuilder should handle Accept-Language header appropriately

Referenced from: commits 6df1a78

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Dec 19, 2017

Juergen Hoeller commented

Rossen Stoyanchev, this looks like a bug to me: The intent behind #19773 was to set common language headers behind the Servlet API request/response state methods, and in this case we seem to accidentally set the request-related header on the response?

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Dec 19, 2017

Rossen Stoyanchev commented

Indeed it's clearly a bug since ACCEPT_LANGUAGE is a request header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.