Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
MockMvc async does not re-use response instance on async dispatch [SPR-16067] #20616
I have a MockMvc test for testing controller with deferred result. It works nice, unit the moment I add ShallowEtagFilter which assumes that the response from the async start request is kept for the following processing. MockMvc.perform always creates new MockHttpServletResponse which causes ShallowEtagFilter to fail. Please, see this demo project for details https://github.com/lukas-krecan-lt/async-demo
Referenced from: commits cd63463
Rossen Stoyanchev commented
I imagine in most cases the response isn't modified until the async dispatch, which explains why no one ever raised this as an issue. That said re-using the response would be more aligned with how it works inside a Servlet container.