Skip to content

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

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

Closed
spring-projects-issues opened this issue Dec 19, 2017 · 2 comments
Assignees
Labels
in: test Issues in the test module type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues 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:

Referenced from: commits 6df1a78

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues 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-projects-issues
Copy link
Collaborator Author

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
Labels
in: test Issues in the test module type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants