Add RFC-5681 support to CacheControl
This commit adds the "stale-while-revalidate" and "stale-if-error" Cache-Control directives in the `CacheControl` support class. Issue: SPR-13841
This commit is contained in:
@@ -63,4 +63,17 @@ public class CacheControlTests {
|
||||
CacheControl cc = CacheControl.noStore();
|
||||
assertThat(cc.getHeaderValue(), Matchers.equalTo("no-store"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void staleIfError() throws Exception {
|
||||
CacheControl cc = CacheControl.maxAge(1, TimeUnit.HOURS).staleIfError(2, TimeUnit.HOURS);
|
||||
assertThat(cc.getHeaderValue(), Matchers.equalTo("max-age=3600, stale-if-error=7200"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void staleWhileRevalidate() throws Exception {
|
||||
CacheControl cc = CacheControl.maxAge(1, TimeUnit.HOURS).staleWhileRevalidate(2, TimeUnit.HOURS);
|
||||
assertThat(cc.getHeaderValue(), Matchers.equalTo("max-age=3600, stale-while-revalidate=7200"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user