Skip to content

HttpEncodingAutoConfiguration is not added to the WebMvcTest slice #23749

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
rob-valor opened this issue Oct 19, 2020 · 1 comment
Closed

HttpEncodingAutoConfiguration is not added to the WebMvcTest slice #23749

rob-valor opened this issue Oct 19, 2020 · 1 comment
Assignees
Labels
type: bug A general bug
Milestone

Comments

@rob-valor
Copy link
Contributor

Affects: 5.4.3

HttpEncodingAutoConfiguration is not added to the WebMvcTest slice. Not sure if this is intentional but when running with full auto-configuration this configuration is loaded in the application context. When starting a test application context with @WebMvcTest the CharacterEncodingFilter provided by the HttpEncodingAutoConfiguration is not added which makes http request processing different in those tests compared to @SpringBootTest or production application context. By default that filter makes request character encoding always UTF-8. see (filter config with default utf-8 being forced for requests)

This is triggered by spring-projects/spring-framework#22788. That made us use MediaType.APPLICATION_JSON (without the character encoding) for the requests during WebMvcTests.

@bclozel bclozel transferred this issue from spring-projects/spring-framework Oct 19, 2020
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 19, 2020
@philwebb philwebb added the for: team-attention An issue we'd like other members of the team to review label Oct 20, 2020
@philwebb philwebb removed the for: team-attention An issue we'd like other members of the team to review label Oct 21, 2020
@bclozel bclozel added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 21, 2020
@bclozel bclozel modified the milestones: 2.5.x, 2.4.x Oct 21, 2020
@bclozel
Copy link
Member

bclozel commented Oct 21, 2020

Indeed, the WebMvcTypeExcludeFilter includes FilterRegistrationBean but not the HttpEncodingAutoConfiguration, which configures the CharacterEncodingFilter if the configuration property is set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants