title: Empty response headers from Spring MockMvc with springSecurityFilterChain
body: <p>I write unit tests for my Spring MVC application. </p>
  
  <p>This is my mockMvc initialization code:</p>
  
  <pre><code>@Configuration
  public class SpringMockFactory {
      @Autowired
      private WebApplicationContext wac;
  
      @Autowired
      private FilterChainProxy springSecurityFilterChain;
  
      @Bean
      @Scope("prototype")
      public MockMvc getMockMvc() {
          return webAppContextSetup(wac)
                  .addFilter(springSecurityFilterChain)
                  .build();
      }
  }
  </code></pre>
  
  <p>Everything works good, but when I add springSecurityFilterChain response headers are always empty (it's important cause I want to check Set-Cookie header).</p>
  
  <p>I use this code to perform action:</p>
  
  <pre><code>resultActions = mockMvc.perform(post("/api/login")
                  .contentType(MediaType.APPLICATION_FORM_URLENCODED)
                  .param("username", "sysadmin")
                  .param("password", "password")
  ).andDo(print());
  </code></pre>
  
  <p>And this is the result of andDo(print()):</p>
  
  <pre><code>MockHttpServletResponse:
            Status = 200
     Error message = null
           Headers = {}
      Content type = null
              Body = {"status":200}
     Forwarded URL = null
    Redirected URL = null
           Cookies = []
  </code></pre>
  
  <p>The question is why are the response headers empty when I use springSecurityFilterChain with mockMvc? And how to read them?</p>