Skip to content

HttpEncodingAutoConfiguration is not added to the WebMvcTest slice #23749

@rob-valor

Description

@rob-valor

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions