Response Compression Example does not show anything useful #34419
Labels
aspnet-core/svc
performance/subsvc
Source - Docs.ms
Docs Customer feedback via GitHub Issue
⌚ Not Triaged
Description
https://learn.microsoft.com/en-us/aspnet/core/performance/response-compression?view=aspnetcore-8.0#azure-deployed-sample
I can see where the compressors are set up, but where are they shown being used?
The example is, with notes added
using Microsoft.AspNetCore.ResponseCompression;
using ResponseCompressionSample;
var builder = WebApplication.CreateBuilder(args);
//MY NOTE -- Here the compressors are set up
//but where are they used????
//Which responses are compressed, and which compression methods are used???
builder.Services.AddResponseCompression(options =>
{
options.EnableForHttps = true;
options.Providers.Add();
options.Providers.Add();
options.Providers.Add();
options.MimeTypes =
ResponseCompressionDefaults.MimeTypes.Concat(
new[] { "image/svg+xml" });
});
var app = builder.Build();
app.UseResponseCompression();
//MY NOTE -- Do any of the following use compression?
//If so, how, and which compression is used?
//Thank you....
app.Map("/trickle", async (HttpResponse httpResponse) =>
{
httpResponse.ContentType = "text/plain;charset=utf-8";
});
app.Map("/testfile1kb.txt", () => Results.File(
app.Environment.ContentRootFileProvider.GetFileInfo("testfile1kb.txt").PhysicalPath,
"text/plain;charset=utf-8"));
app.Map("/banner.svg", () => Results.File(
app.Environment.ContentRootFileProvider.GetFileInfo("banner.svg").PhysicalPath,
"image/svg+xml;charset=utf-8"));
app.MapFallback(() => LoremIpsum.Text);
app.Run();
Page URL
https://learn.microsoft.com/en-us/aspnet/core/performance/response-compression?view=aspnetcore-8.0
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/performance/response-compression.md
Document ID
2d56d9b6-3d7b-0204-6c08-8e584fccecc2
Article author
@tdykstra
Related Issues
The text was updated successfully, but these errors were encountered: