【发布时间】:2013-10-06 10:06:27
【问题描述】:
我正在使用 spring-test-mvc 测试我的 MVC 服务,我使用了类似的东西:
MockMvc mockMvc = standaloneSetup(controller).build();
mockMvc.perform(get("<my-url>")).andExpect(content().bytes(expectedBytes)).andExpect(content().type("image/png"))
.andExpect(header().string("cache-control", "max-age=3600"));
效果很好。
现在我将缓存图像更改为在特定范围内随机。例如,可以用3500-3700 代替3600。我试图弄清楚如何获取标头值并对其进行一些测试,而不是使用andExpect 的这种模式。
【问题讨论】:
标签: java spring spring-mvc spring-test-mvc