Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/RazorSdk/update-test-baselines.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
param([switch] $Validate)
$RepoRoot= Resolve-Path "$PSScriptRoot/../.."

$TestProjects = "Microsoft.NET.Sdk.Razor.Tests", "Microsoft.NET.Sdk.BlazorWebAssembly.Tests" |
$TestProjects = "Microsoft.NET.Sdk.StaticWebAssets.Tests", "Microsoft.NET.Sdk.Razor.Tests", "Microsoft.NET.Sdk.BlazorWebAssembly.Tests" |
ForEach-Object { Join-Path -Path "$RepoRoot/test/" -ChildPath $_ };

if($Validate){
Expand Down
Empty file modified src/RazorSdk/update-test-baselines.sh
100644 → 100755
Empty file.
11 changes: 3 additions & 8 deletions src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssetEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,8 @@ private void CreateAnAddEndpoints(
foreach (var (label, route, values) in _resolvedRoutes)
{
var (mimeType, cacheSetting) = ResolveContentType(asset, ContentTypeProvider, matchContext, Log);
var headers = new StaticWebAssetEndpointResponseHeader[6]
var headers = new StaticWebAssetEndpointResponseHeader[5]
{
new()
{
Name = "Accept-Ranges",
Value = "bytes"
},
new()
{
Name = "Content-Length",
Expand Down Expand Up @@ -159,14 +154,14 @@ private void CreateAnAddEndpoints(
{
// max-age=31536000 is one year in seconds. immutable means that the asset will never change.
// max-age is for browsers that do not support immutable.
headers[5] = new() { Name = "Cache-Control", Value = "max-age=31536000, immutable" };
headers[4] = new() { Name = "Cache-Control", Value = "max-age=31536000, immutable" };
}
else
{
// Force revalidation on non-fingerprinted assets. We can be more granular here and have rules based on the content type.
// These values can later be changed at runtime by modifying the endpoint. For example, it might be safer to cache images
// for a longer period of time than scripts or stylesheets.
headers[5] = new() { Name = "Cache-Control", Value = !string.IsNullOrEmpty(cacheSetting) ? cacheSetting : "no-cache" };
headers[4] = new() { Name = "Cache-Control", Value = !string.IsNullOrEmpty(cacheSetting) ? cacheSetting : "no-cache" };
}

var properties = new StaticWebAssetEndpointProperty[values.Count + (values.Count > 0 ? 2 : 1)];
Expand Down
Loading