.NET 8 Update (#2496)

This commit is contained in:
Joe Milazzo 2023-12-13 19:16:54 -06:00 committed by GitHub
parent 6d4d2d4a7f
commit b838fd53e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
75 changed files with 590 additions and 405 deletions

View file

@ -21,8 +21,8 @@ public static class HttpExtensions
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
};
response.Headers.Add("Pagination", JsonSerializer.Serialize(paginationHeader, options));
response.Headers.Add("Access-Control-Expose-Headers", "Pagination");
response.Headers.Append("Pagination", JsonSerializer.Serialize(paginationHeader, options));
response.Headers.Append("Access-Control-Expose-Headers", "Pagination");
}
/// <summary>
@ -33,7 +33,7 @@ public static class HttpExtensions
public static void AddCacheHeader(this HttpResponse response, byte[] content)
{
if (content is not {Length: > 0}) return;
response.Headers.Add(HeaderNames.ETag, string.Concat(SHA256.HashData(content).Select(x => x.ToString("X2"))));
response.Headers.Append(HeaderNames.ETag, string.Concat(SHA256.HashData(content).Select(x => x.ToString("X2"))));
response.Headers.CacheControl = $"private,max-age=100";
}
@ -47,7 +47,7 @@ public static class HttpExtensions
{
if (filename is not {Length: > 0}) return;
var hashContent = filename + File.GetLastWriteTimeUtc(filename);
response.Headers.Add("ETag", string.Concat(SHA256.HashData(Encoding.UTF8.GetBytes(hashContent)).Select(x => x.ToString("X2"))));
response.Headers.Append("ETag", string.Concat(SHA256.HashData(Encoding.UTF8.GetBytes(hashContent)).Select(x => x.ToString("X2"))));
if (maxAge != 10)
{
response.Headers.CacheControl = $"max-age={maxAge}";