Skip to content

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

Closed

Description

@spring-projects-issues

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

Activity

  1. spring-projects-issues commented on Dec 19, 2017

    @spring-projects-issues
    CollaboratorAuthor

    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?

  2. spring-projects-issues commented on Dec 19, 2017

    @spring-projects-issues
    CollaboratorAuthor

    Rossen Stoyanchev commented

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

  3. added
    type: bug
    in: test
    on Jan 11, 2019
  4. added this to the 5.0.3 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: testtype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions