Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
MvcResult-->mockResponse-->headers will lose a apart of headers [SPR-16865] #21404
my code(use apache shiro)
view in chrome
this problem lead to we can't test after login
Rossen Stoyanchev commented
MockMvc runs with a mock request and response, and without a server. The most likely explanation is the mock response reflects only what was actually added. Why do you think it's "losing" headers, and how would it actually lose them?
By contrast at runtime, an application may have extra configuration (e.g. extra filters), which may add headers, the server itself may add headers, and any proxies in between client and server may also add headers.
So differences with a response from a browser are expected. Which headers exactly are causing you an issue? Can you show how MockMvc is set up?