Skip to content

Commit 7186eeb

Browse files
Copilotjaviercn
andauthored
[StaticWebAssets] Remove Accept-Ranges header from DefineStaticWebAssetEndpoints (#50149)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: javiercn <[email protected]> Co-authored-by: Javier Calvarro Nelson <[email protected]>
1 parent 4431825 commit 7186eeb

File tree

81 files changed

+1507
-35934
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1507
-35934
lines changed

src/RazorSdk/update-test-baselines.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
param([switch] $Validate)
22
$RepoRoot= Resolve-Path "$PSScriptRoot/../.."
33

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

77
if($Validate){

src/RazorSdk/update-test-baselines.sh

100644100755
File mode changed.

src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssetEndpoints.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,8 @@ private void CreateAnAddEndpoints(
125125
foreach (var (label, route, values) in _resolvedRoutes)
126126
{
127127
var (mimeType, cacheSetting) = ResolveContentType(asset, ContentTypeProvider, matchContext, Log);
128-
var headers = new StaticWebAssetEndpointResponseHeader[6]
128+
var headers = new StaticWebAssetEndpointResponseHeader[5]
129129
{
130-
new()
131-
{
132-
Name = "Accept-Ranges",
133-
Value = "bytes"
134-
},
135130
new()
136131
{
137132
Name = "Content-Length",
@@ -159,14 +154,14 @@ private void CreateAnAddEndpoints(
159154
{
160155
// max-age=31536000 is one year in seconds. immutable means that the asset will never change.
161156
// max-age is for browsers that do not support immutable.
162-
headers[5] = new() { Name = "Cache-Control", Value = "max-age=31536000, immutable" };
157+
headers[4] = new() { Name = "Cache-Control", Value = "max-age=31536000, immutable" };
163158
}
164159
else
165160
{
166161
// Force revalidation on non-fingerprinted assets. We can be more granular here and have rules based on the content type.
167162
// These values can later be changed at runtime by modifying the endpoint. For example, it might be safer to cache images
168163
// for a longer period of time than scripts or stylesheets.
169-
headers[5] = new() { Name = "Cache-Control", Value = !string.IsNullOrEmpty(cacheSetting) ? cacheSetting : "no-cache" };
164+
headers[4] = new() { Name = "Cache-Control", Value = !string.IsNullOrEmpty(cacheSetting) ? cacheSetting : "no-cache" };
170165
}
171166

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

0 commit comments

Comments
 (0)