-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Allow filters to be registered with MockMvc for particular dispatcher types #27717
Comments
On AbstractMockMvcBuilder we have:
We could also have:
Is this what you had in mind as well? |
To align with the Servlet API on |
@wilkinsona I would like to implement this enhancement. From what I understood, I need to add Inside the new Here is how it will look like:
|
Thanks, but I am not a member of the Spring Framework team. If you are interested in contributing, @rstoyanchev would be a better person to discuss things with. |
@rstoyanchev Could you kindly give your feedback on my comment? Then I can implement it and raise a PR. |
@rstoyanchev Could you please give an update on this? I want to make sure that my approach on this is correct. Thanks! |
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 withMockMvc
. I overlooked the fact thatMockMvc
'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.The text was updated successfully, but these errors were encountered: