Merge remote-tracking branch 'ResponseCaching/rybrande/masterToSrc' into rybrande/Mondo22ToMaster

This commit is contained in:
Ryan Brandenburg 2018-11-26 12:35:16 -08:00
commit a498d273e7
6 changed files with 57 additions and 66 deletions

View File

@ -1,9 +1,8 @@
ASP.NET Core Response Caching
========
AppVeyor: [![AppVeyor](https://ci.appveyor.com/api/projects/status/p52yj0kghdyicvwu/branch/dev?svg=true)](https://ci.appveyor.com/project/aspnetci/ResponseCaching/branch/dev)
ASP.NET Core Response Caching [Archived]
========================================
Travis: [![Travis](https://travis-ci.org/aspnet/ResponseCaching.svg?branch=dev)](https://travis-ci.org/aspnet/ResponseCaching)
**This GitHub project has been archived.** Ongoing development on this project can be found in <https://github.com/aspnet/AspNetCore>.
This repo hosts the ASP.NET Core middleware for response caching.
This project is part of ASP.NET Core. You can find samples, documentation and getting started instructions for ASP.NET Core at the [Home](https://github.com/aspnet/home) repo.
This project is part of ASP.NET Core. You can find samples, documentation and getting started instructions for ASP.NET Core at the [AspNetCore](https://github.com/aspnet/AspNetCore) repo.

View File

@ -3,24 +3,24 @@
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<PropertyGroup Label="Package Versions">
<InternalAspNetCoreSdkPackageVersion>2.2.0-preview2-20181004.6</InternalAspNetCoreSdkPackageVersion>
<MicrosoftAspNetCoreHttpExtensionsPackageVersion>2.2.0-preview3-35425</MicrosoftAspNetCoreHttpExtensionsPackageVersion>
<MicrosoftAspNetCoreHttpPackageVersion>2.2.0-preview3-35425</MicrosoftAspNetCoreHttpPackageVersion>
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.2.0-preview3-35425</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.2.0-preview3-35425</MicrosoftAspNetCoreServerKestrelPackageVersion>
<MicrosoftAspNetCoreTestHostPackageVersion>2.2.0-preview3-35425</MicrosoftAspNetCoreTestHostPackageVersion>
<MicrosoftExtensionsCachingMemoryPackageVersion>2.2.0-preview3-35425</MicrosoftExtensionsCachingMemoryPackageVersion>
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>2.2.0-preview3-35425</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
<MicrosoftExtensionsLoggingTestingPackageVersion>2.2.0-preview3-35425</MicrosoftExtensionsLoggingTestingPackageVersion>
<MicrosoftExtensionsPrimitivesPackageVersion>2.2.0-preview3-35425</MicrosoftExtensionsPrimitivesPackageVersion>
<InternalAspNetCoreSdkPackageVersion>3.0.0-alpha1-20181004.7</InternalAspNetCoreSdkPackageVersion>
<MicrosoftAspNetCoreHttpExtensionsPackageVersion>3.0.0-alpha1-10584</MicrosoftAspNetCoreHttpExtensionsPackageVersion>
<MicrosoftAspNetCoreHttpPackageVersion>3.0.0-alpha1-10584</MicrosoftAspNetCoreHttpPackageVersion>
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>3.0.0-alpha1-10584</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
<MicrosoftAspNetCoreServerKestrelPackageVersion>3.0.0-alpha1-10584</MicrosoftAspNetCoreServerKestrelPackageVersion>
<MicrosoftAspNetCoreTestHostPackageVersion>3.0.0-alpha1-10584</MicrosoftAspNetCoreTestHostPackageVersion>
<MicrosoftExtensionsCachingMemoryPackageVersion>3.0.0-alpha1-10584</MicrosoftExtensionsCachingMemoryPackageVersion>
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>3.0.0-alpha1-10584</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
<MicrosoftExtensionsLoggingTestingPackageVersion>3.0.0-alpha1-10584</MicrosoftExtensionsLoggingTestingPackageVersion>
<MicrosoftExtensionsPrimitivesPackageVersion>3.0.0-alpha1-10584</MicrosoftExtensionsPrimitivesPackageVersion>
<MicrosoftNETCoreApp20PackageVersion>2.0.9</MicrosoftNETCoreApp20PackageVersion>
<MicrosoftNETCoreApp21PackageVersion>2.1.3</MicrosoftNETCoreApp21PackageVersion>
<MicrosoftNETCoreApp22PackageVersion>2.2.0-preview3-27001-02</MicrosoftNETCoreApp22PackageVersion>
<MicrosoftNETCoreApp22PackageVersion>2.2.0-preview2-26905-02</MicrosoftNETCoreApp22PackageVersion>
<MicrosoftNETTestSdkPackageVersion>15.6.1</MicrosoftNETTestSdkPackageVersion>
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion>
<XunitPackageVersion>2.3.1</XunitPackageVersion>
<XunitRunnerVisualStudioPackageVersion>2.4.0</XunitRunnerVisualStudioPackageVersion>
</PropertyGroup>
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
<PropertyGroup Label="Package Versions: Pinned" />
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
</Project>

View File

@ -4,7 +4,6 @@
<PropertyGroup>
<!-- These properties are use by the automation that updates dependencies.props -->
<LineupPackageId>Internal.AspNetCore.Universe.Lineup</LineupPackageId>
<LineupPackageVersion>2.2.0-*</LineupPackageVersion>
<LineupPackageRestoreSource>https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json</LineupPackageRestoreSource>
</PropertyGroup>

View File

@ -25,7 +25,6 @@ namespace Microsoft.Extensions.DependencyInjection
throw new ArgumentNullException(nameof(services));
}
services.AddMemoryCache();
services.TryAdd(ServiceDescriptor.Singleton<IResponseCachingPolicyProvider, ResponseCachingPolicyProvider>());
services.TryAdd(ServiceDescriptor.Singleton<IResponseCachingKeyProvider, ResponseCachingKeyProvider>());

View File

@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
[Theory]
[InlineData("GET")]
[InlineData("HEAD")]
public async void ServesCachedContent_IfAvailable(string method)
public async Task ServesCachedContent_IfAvailable(string method)
{
var builders = TestUtils.CreateBuildersWithResponseCaching();
@ -39,7 +39,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
[Theory]
[InlineData("GET")]
[InlineData("HEAD")]
public async void ServesFreshContent_IfNotAvailable(string method)
public async Task ServesFreshContent_IfNotAvailable(string method)
{
var builders = TestUtils.CreateBuildersWithResponseCaching();
@ -57,7 +57,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesFreshContent_Post()
public async Task ServesFreshContent_Post()
{
var builders = TestUtils.CreateBuildersWithResponseCaching();
@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesFreshContent_Head_Get()
public async Task ServesFreshContent_Head_Get()
{
var builders = TestUtils.CreateBuildersWithResponseCaching();
@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesFreshContent_Get_Head()
public async Task ServesFreshContent_Get_Head()
{
var builders = TestUtils.CreateBuildersWithResponseCaching();
@ -113,7 +113,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
[Theory]
[InlineData("GET")]
[InlineData("HEAD")]
public async void ServesFreshContent_If_CacheControlNoCache(string method)
public async Task ServesFreshContent_If_CacheControlNoCache(string method)
{
var builders = TestUtils.CreateBuildersWithResponseCaching();
@ -142,7 +142,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
[Theory]
[InlineData("GET")]
[InlineData("HEAD")]
public async void ServesFreshContent_If_PragmaNoCache(string method)
public async Task ServesFreshContent_If_PragmaNoCache(string method)
{
var builders = TestUtils.CreateBuildersWithResponseCaching();
@ -171,7 +171,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
[Theory]
[InlineData("GET")]
[InlineData("HEAD")]
public async void ServesCachedContent_If_PathCasingDiffers(string method)
public async Task ServesCachedContent_If_PathCasingDiffers(string method)
{
var builders = TestUtils.CreateBuildersWithResponseCaching();
@ -191,7 +191,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
[Theory]
[InlineData("GET")]
[InlineData("HEAD")]
public async void ServesFreshContent_If_ResponseExpired(string method)
public async Task ServesFreshContent_If_ResponseExpired(string method)
{
var builders = TestUtils.CreateBuildersWithResponseCaching();
@ -211,7 +211,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
[Theory]
[InlineData("GET")]
[InlineData("HEAD")]
public async void ServesFreshContent_If_Authorization_HeaderExists(string method)
public async Task ServesFreshContent_If_Authorization_HeaderExists(string method)
{
var builders = TestUtils.CreateBuildersWithResponseCaching();
@ -230,7 +230,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesCachedContent_IfVaryHeader_Matches()
public async Task ServesCachedContent_IfVaryHeader_Matches()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.Headers[HeaderNames.Vary] = HeaderNames.From);
@ -249,7 +249,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesFreshContent_IfVaryHeader_Mismatches()
public async Task ServesFreshContent_IfVaryHeader_Mismatches()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.Headers[HeaderNames.Vary] = HeaderNames.From);
@ -269,7 +269,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesCachedContent_IfVaryQueryKeys_Matches()
public async Task ServesCachedContent_IfVaryQueryKeys_Matches()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Features.Get<IResponseCachingFeature>().VaryByQueryKeys = new[] { "query" });
@ -287,7 +287,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesCachedContent_IfVaryQueryKeysExplicit_Matches_QueryKeyCaseInsensitive()
public async Task ServesCachedContent_IfVaryQueryKeysExplicit_Matches_QueryKeyCaseInsensitive()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Features.Get<IResponseCachingFeature>().VaryByQueryKeys = new[] { "QueryA", "queryb" });
@ -305,7 +305,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesCachedContent_IfVaryQueryKeyStar_Matches_QueryKeyCaseInsensitive()
public async Task ServesCachedContent_IfVaryQueryKeyStar_Matches_QueryKeyCaseInsensitive()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Features.Get<IResponseCachingFeature>().VaryByQueryKeys = new[] { "*" });
@ -323,7 +323,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesCachedContent_IfVaryQueryKeyExplicit_Matches_OrderInsensitive()
public async Task ServesCachedContent_IfVaryQueryKeyExplicit_Matches_OrderInsensitive()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Features.Get<IResponseCachingFeature>().VaryByQueryKeys = new[] { "QueryB", "QueryA" });
@ -341,7 +341,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesCachedContent_IfVaryQueryKeyStar_Matches_OrderInsensitive()
public async Task ServesCachedContent_IfVaryQueryKeyStar_Matches_OrderInsensitive()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Features.Get<IResponseCachingFeature>().VaryByQueryKeys = new[] { "*" });
@ -359,7 +359,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesFreshContent_IfVaryQueryKey_Mismatches()
public async Task ServesFreshContent_IfVaryQueryKey_Mismatches()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Features.Get<IResponseCachingFeature>().VaryByQueryKeys = new[] { "query" });
@ -377,7 +377,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesFreshContent_IfVaryQueryKeyExplicit_Mismatch_QueryKeyCaseSensitive()
public async Task ServesFreshContent_IfVaryQueryKeyExplicit_Mismatch_QueryKeyCaseSensitive()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Features.Get<IResponseCachingFeature>().VaryByQueryKeys = new[] { "QueryA", "QueryB" });
@ -395,7 +395,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesFreshContent_IfVaryQueryKeyStar_Mismatch_QueryKeyValueCaseSensitive()
public async Task ServesFreshContent_IfVaryQueryKeyStar_Mismatch_QueryKeyValueCaseSensitive()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Features.Get<IResponseCachingFeature>().VaryByQueryKeys = new[] { "*" });
@ -413,7 +413,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesFreshContent_IfRequestRequirements_NotMet()
public async Task ServesFreshContent_IfRequestRequirements_NotMet()
{
var builders = TestUtils.CreateBuildersWithResponseCaching();
@ -435,7 +435,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void Serves504_IfOnlyIfCachedHeader_IsSpecified()
public async Task Serves504_IfOnlyIfCachedHeader_IsSpecified()
{
var builders = TestUtils.CreateBuildersWithResponseCaching();
@ -458,7 +458,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesFreshContent_IfSetCookie_IsSpecified()
public async Task ServesFreshContent_IfSetCookie_IsSpecified()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.Headers[HeaderNames.SetCookie] = "cookieName=cookieValue");
@ -476,7 +476,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesCachedContent_IfIHttpSendFileFeature_NotUsed()
public async Task ServesCachedContent_IfIHttpSendFileFeature_NotUsed()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(app =>
{
@ -501,7 +501,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesFreshContent_IfIHttpSendFileFeature_Used()
public async Task ServesFreshContent_IfIHttpSendFileFeature_Used()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(
app =>
@ -528,7 +528,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesCachedContent_IfSubsequentRequestContainsNoStore()
public async Task ServesCachedContent_IfSubsequentRequestContainsNoStore()
{
var builders = TestUtils.CreateBuildersWithResponseCaching();
@ -550,7 +550,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesFreshContent_IfInitialRequestContainsNoStore()
public async Task ServesFreshContent_IfInitialRequestContainsNoStore()
{
var builders = TestUtils.CreateBuildersWithResponseCaching();
@ -572,7 +572,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesFreshContent_IfInitialResponseContainsNoStore()
public async Task ServesFreshContent_IfInitialResponseContainsNoStore()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.Headers[HeaderNames.CacheControl] = CacheControlHeaderValue.NoStoreString);
@ -590,7 +590,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void Serves304_IfIfModifiedSince_Satisfied()
public async Task Serves304_IfIfModifiedSince_Satisfied()
{
var builders = TestUtils.CreateBuildersWithResponseCaching();
@ -610,7 +610,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesCachedContent_IfIfModifiedSince_NotSatisfied()
public async Task ServesCachedContent_IfIfModifiedSince_NotSatisfied()
{
var builders = TestUtils.CreateBuildersWithResponseCaching();
@ -629,7 +629,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void Serves304_IfIfNoneMatch_Satisfied()
public async Task Serves304_IfIfNoneMatch_Satisfied()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.GetTypedHeaders().ETag = new EntityTagHeaderValue("\"E1\""));
@ -649,7 +649,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesCachedContent_IfIfNoneMatch_NotSatisfied()
public async Task ServesCachedContent_IfIfNoneMatch_NotSatisfied()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.GetTypedHeaders().ETag = new EntityTagHeaderValue("\"E1\""));
@ -668,7 +668,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesCachedContent_IfBodySize_IsCacheable()
public async Task ServesCachedContent_IfBodySize_IsCacheable()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(options: new ResponseCachingOptions()
{
@ -689,7 +689,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesFreshContent_IfBodySize_IsNotCacheable()
public async Task ServesFreshContent_IfBodySize_IsNotCacheable()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(options: new ResponseCachingOptions()
{
@ -710,7 +710,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesFreshContent_CaseSensitivePaths_IsNotCacheable()
public async Task ServesFreshContent_CaseSensitivePaths_IsNotCacheable()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(options: new ResponseCachingOptions()
{
@ -731,7 +731,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesCachedContent_WithoutReplacingCachedVaryBy_OnCacheMiss()
public async Task ServesCachedContent_WithoutReplacingCachedVaryBy_OnCacheMiss()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.Headers[HeaderNames.Vary] = HeaderNames.From);
@ -753,7 +753,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesFreshContent_IfCachedVaryByUpdated_OnCacheMiss()
public async Task ServesFreshContent_IfCachedVaryByUpdated_OnCacheMiss()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.Headers[HeaderNames.Vary] = context.Request.Headers[HeaderNames.Pragma]);
@ -784,7 +784,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
}
[Fact]
public async void ServesCachedContent_IfCachedVaryByNotUpdated_OnCacheMiss()
public async Task ServesCachedContent_IfCachedVaryByNotUpdated_OnCacheMiss()
{
var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.Headers[HeaderNames.Vary] = context.Request.Headers[HeaderNames.Pragma]);

View File

@ -1,12 +1,6 @@
<Project>
<Project>
<PropertyGroup>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix>rtm</VersionSuffix>
<PackageVersion Condition="'$(IsFinalBuild)' == 'true' AND '$(VersionSuffix)' == 'rtm' ">$(VersionPrefix)</PackageVersion>
<PackageVersion Condition="'$(IsFinalBuild)' == 'true' AND '$(VersionSuffix)' != 'rtm' ">$(VersionPrefix)-$(VersionSuffix)-final</PackageVersion>
<BuildNumber Condition="'$(BuildNumber)' == ''">t000</BuildNumber>
<FeatureBranchVersionPrefix Condition="'$(FeatureBranchVersionPrefix)' == ''">a-</FeatureBranchVersionPrefix>
<VersionSuffix Condition="'$(VersionSuffix)' != '' And '$(FeatureBranchVersionSuffix)' != ''">$(FeatureBranchVersionPrefix)$(VersionSuffix)-$([System.Text.RegularExpressions.Regex]::Replace('$(FeatureBranchVersionSuffix)', '[^\w-]', '-'))</VersionSuffix>
<VersionSuffix Condition="'$(VersionSuffix)' != '' And '$(BuildNumber)' != ''">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
<VersionPrefix>3.0.0</VersionPrefix>
<VersionSuffix Condition=" '$(VersionSuffix)' == '' ">dev</VersionSuffix>
</PropertyGroup>
</Project>