Skip to content

Allow filters to be registered with MockMvc for particular dispatcher types #27717

@wilkinsona

Description

@wilkinsona

In Spring Boot 2.6, we've introduced a new filter that's only registered for ERROR dispatches. This works fine at runtime and in integration tests over HTTP, but doesn't work as intended when testing with MockMvc. I overlooked the fact that MockMvc's filter chain includes every known filter, irrespective of the request's dispatcher type. When adding a filter, it would be useful to be able to specify the filter's dispatcher types, as you can do with the Servlet API. In the meantime, we can fix Boot by updating the filter to ignore non-ERROR requests.

Metadata

Metadata

Assignees

Labels

in: testIssues in the test modulein: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions