@Test public void testCachingHeadersDisabled() throws Exception { CapabilitiesCacheHeadersCallback callback = GeoServerExtensions.bean(CapabilitiesCacheHeadersCallback.class); boolean backup = callback.isCapabilitiesCacheHeadersEnabled(); try { callback.setCapabilitiesCacheHeadersEnabled(false); // first request, get the etag MockHttpServletRequest request = createGetRequestWithHeaders( "wfs?service=WFS&version=1.0.0&request=getCapabilities"); MockHttpServletResponse response = dispatch(request); assertEquals(HttpStatus.OK.value(), response.getStatus()); // check caching headers are not there assertNull(response.getHeader(HttpHeaders.ETAG)); assertNull(response.getHeader(HttpHeaders.CACHE_CONTROL)); } finally { callback.setCapabilitiesCacheHeadersEnabled(backup); } }