File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -297,8 +297,6 @@ mod tests {
297297 . cache_control_stale_while_revalidate ( stale_while_revalidate)
298298 . build ( ) ?;
299299
300- // let headers = policy.clone().render(&config)?;
301-
302300 fn validate_headers ( headers : & ResponseCacheHeaders ) -> Result < ( ) > {
303301 if let Some ( ref cache_control) = headers. cache_control {
304302 validate_cache_control ( cache_control)
@@ -375,19 +373,25 @@ mod tests {
375373 #[ test]
376374 fn render_fastly_forever_in_cdn ( ) -> Result < ( ) > {
377375 let config = TestEnvironment :: base_config ( ) . build ( ) ?;
376+ // this surrogate key is user-defined, identifies the crate.
378377 let key = SurrogateKey :: from_static ( "something" ) ;
379378 let headers = CachePolicy :: ForeverInCdn ( key. clone ( ) . into ( ) ) . render ( & config) ?;
380379
380+ // browser or other proxies: mostly no caching
381381 assert_eq ! (
382382 headers. cache_control,
383383 Some ( HeaderValue :: from_static( "max-age=0" ) )
384384 ) ;
385385
386+ // CDN: cache forever.
387+ // Fastly will completely ignore cache-control if it finds surrogate-control.
386388 assert_eq ! (
387389 headers. surrogate_control,
388390 Some ( HeaderValue :: from_static( "max-age=31536000" ) )
389391 ) ;
390392
393+ // both: our key + the global "all" key.
394+ // So we can purge the CDN for these keys.
391395 assert_eq ! (
392396 headers. surrogate_keys. unwrap( ) ,
393397 SurrogateKeys :: try_from_iter( [ key, SURROGATE_KEY_ALL ] ) . unwrap( )
You can’t perform that action at this time.
0 commit comments