title: Custom test of http header with spring-test-mvc
body: <p>I'm testing my MVC service with <code>spring-test-mvc</code> I used something like:</p>
  
  <pre><code>MockMvc mockMvc = standaloneSetup(controller).build();
  mockMvc.perform(get("&lt;my-url&gt;")).andExpect(content().bytes(expectedBytes)).andExpect(content().type("image/png"))
         .andExpect(header().string("cache-control", "max-age=3600"));
  </code></pre>
  
  <p>Which worked fine.</p>
  
  <p>Now I changed the cache image to be random in a specific range. For example, instead of <code>3600</code> it could be <code>3500-3700</code>. I'm trying to figure out how I can get the header value and do some tests on it instead of using this pattern of <code>andExpect</code>.</p>