Merge branch '4.1.x'
This commit is contained in:
@@ -81,7 +81,7 @@ public class ResponseCacheManager {
|
||||
this.ignoreNoCacheUpdate = isSkipNoCacheUpdateActive(requestOptions);
|
||||
this.afterCacheExchangeMutators = List.of(new SetResponseHeadersAfterCacheExchangeMutator(),
|
||||
new SetStatusCodeAfterCacheExchangeMutator(),
|
||||
new RemoveHeadersAfterCacheExchangeMutator(HttpHeaders.PRAGMA),
|
||||
new RemoveHeadersAfterCacheExchangeMutator(HttpHeaders.PRAGMA, HttpHeaders.EXPIRES),
|
||||
new SetMaxAgeHeaderAfterCacheExchangeMutator(configuredTimeToLive, Clock.systemDefaultZone(),
|
||||
ignoreNoCacheUpdate),
|
||||
new SetCacheDirectivesByMaxAgeAfterCacheExchangeMutator());
|
||||
|
||||
@@ -353,6 +353,15 @@ public class LocalResponseCacheGatewayFilterFactoryTests extends BaseWebClientTe
|
||||
|
||||
@Test
|
||||
void shouldNotReturnPragmaHeaderInNonCachedAndCachedResponses() {
|
||||
shouldNotReturnHeader(HttpHeaders.PRAGMA);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldNotReturnExpiresHeaderInNonCachedAndCachedResponses() {
|
||||
shouldNotReturnHeader(HttpHeaders.EXPIRES);
|
||||
}
|
||||
|
||||
private void shouldNotReturnHeader(String header) {
|
||||
String uri = "/" + UUID.randomUUID() + "/cache/headers";
|
||||
|
||||
testClient.get()
|
||||
@@ -360,14 +369,14 @@ public class LocalResponseCacheGatewayFilterFactoryTests extends BaseWebClientTe
|
||||
.header("Host", "www.localresponsecache.org")
|
||||
.exchange()
|
||||
.expectHeader()
|
||||
.doesNotExist(HttpHeaders.PRAGMA);
|
||||
.doesNotExist(header);
|
||||
|
||||
testClient.get()
|
||||
.uri(uri)
|
||||
.header("Host", "www.localresponsecache.org")
|
||||
.exchange()
|
||||
.expectHeader()
|
||||
.doesNotExist(HttpHeaders.PRAGMA);
|
||||
.doesNotExist(header);
|
||||
}
|
||||
|
||||
void assertNonVaryHeaderInContent(String uri, String varyHeader, String varyHeaderValue, String nonVaryHeader,
|
||||
|
||||
@@ -126,6 +126,15 @@ public class LocalResponseCacheGlobalFilterTests {
|
||||
|
||||
@Test
|
||||
void shouldNotReturnPragmaHeaderInNonCachedAndCachedResponses() {
|
||||
shouldNotReturnHeader(HttpHeaders.PRAGMA);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldNotReturnExpiresHeaderInNonCachedAndCachedResponses() {
|
||||
shouldNotReturnHeader(HttpHeaders.EXPIRES);
|
||||
}
|
||||
|
||||
private void shouldNotReturnHeader(String header) {
|
||||
String uri = "/" + UUID.randomUUID() + "/global-cache/headers";
|
||||
|
||||
testClient.get()
|
||||
@@ -133,14 +142,14 @@ public class LocalResponseCacheGlobalFilterTests {
|
||||
.header("Host", "www.localresponsecache.org")
|
||||
.exchange()
|
||||
.expectHeader()
|
||||
.doesNotExist(HttpHeaders.PRAGMA);
|
||||
.doesNotExist(header);
|
||||
|
||||
testClient.get()
|
||||
.uri(uri)
|
||||
.header("Host", "www.localresponsecache.org")
|
||||
.exchange()
|
||||
.expectHeader()
|
||||
.doesNotExist(HttpHeaders.PRAGMA);
|
||||
.doesNotExist(header);
|
||||
}
|
||||
|
||||
@EnableAutoConfiguration
|
||||
|
||||
Reference in New Issue
Block a user