public ShouldIgnoreCachePublic ( |
||
cacheControl | ||
request | ||
return | bool |
public bool Should_be_determined_from_MaxAge_and_cacheControl(int maxAge, bool? noCache, bool? noStore, int? cacheControlMaxAge, bool ignoreRevalidation) { CacheControlHeaderValue cacheControl = null; if (noCache.HasValue || noStore.HasValue || cacheControlMaxAge.HasValue) { cacheControl = new CacheControlHeaderValue { NoCache = noCache ?? false, NoStore = noStore ?? false, }; if (cacheControlMaxAge.HasValue) { cacheControl.MaxAge = TimeSpan.FromSeconds(cacheControlMaxAge.Value); } } var att = new OutputCacheAttributeWithPublicMethods { MaxAge = (uint)maxAge, IgnoreRevalidationRequest = ignoreRevalidation }; // Action return att.ShouldIgnoreCachePublic(cacheControl, new HttpRequestMessage()); }
public bool Should_be_determined_from_MaxAge_and_cacheControl(int maxAge, bool?noCache, bool?noStore, int?cacheControlMaxAge, bool ignoreRevalidation) { CacheControlHeaderValue cacheControl = null; if (noCache.HasValue || noStore.HasValue || cacheControlMaxAge.HasValue) { cacheControl = new CacheControlHeaderValue { NoCache = noCache ?? false, NoStore = noStore ?? false, }; if (cacheControlMaxAge.HasValue) { cacheControl.MaxAge = TimeSpan.FromSeconds(cacheControlMaxAge.Value); } } var att = new OutputCacheAttributeWithPublicMethods { MaxAge = (uint)maxAge, IgnoreRevalidationRequest = ignoreRevalidation }; // Action return(att.ShouldIgnoreCachePublic(cacheControl, new HttpRequestMessage())); }
public void Should_return_true_if_request_property_has_key_telling_no_cache() { var att = new OutputCacheAttributeWithPublicMethods { MaxAge = 10 }; var request = new HttpRequestMessage { Properties = {{$"{WebApiExtensions.__flatwhite_dont_cache}_for_test", true}} }; // Action Assert.IsTrue(att.ShouldIgnoreCachePublic(new CacheControlHeaderValue(), request)); }
public void Should_return_true_if_request_property_has_key_telling_no_cache() { var att = new OutputCacheAttributeWithPublicMethods { MaxAge = 10 }; var request = new HttpRequestMessage { Properties = { { $"{WebApiExtensions.__flatwhite_dont_cache}_for_test", true } } }; // Action Assert.IsTrue(att.ShouldIgnoreCachePublic(new CacheControlHeaderValue(), request)); }