Skip to content

Support Accept-Language header in MockHttpServletRequest's getLocale() and getLocales() methods [SPR-11701] #16323

@spring-projects-issues

Description

@spring-projects-issues

Rob Winch opened SPR-11701 and commented

Overview

Currently the MockHttpServletRequest defaults to Locale.ENGLISH. However, the ServletRequest javadoc states:

If the client request doesn't provide an Accept-Language header, this method returns the default locale for the server.

We should probably also have some sort of way to ensure that if the Accept-Language header is specified that it is synched with the Locale (similar to Content-Type).


Deliverables

  1. Update class-level Javadoc for MockHttpServletRequest with information regarding the default locale for the mocked server.
  2. (?) Ensure that MockHttpServletRequest.getLocale() complies with the Javadoc from the Servlet specification with regard to the Accept-Language header.
  3. (?) Ensure that MockHttpServletRequest.getLocales() complies with the Javadoc from the Servlet specification with regard to the Accept-Language header.

Affects: 4.0.3

Reference URL: https://github.com/spring-projects/spring-test-mvc-htmlunit/issues/21

Issue Links:

Referenced from: commits 9bf73f3

Metadata

Metadata

Assignees

Labels

in: testIssues in the test modulestatus: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions