// namespace SafeCampus.Core; /// /// Gzip压缩组件 /// public sealed class GzipCompressionComponent : IServiceComponent { public void Load(IServiceCollection services, ComponentContext componentContext) { services.Configure(options => { options.Level = CompressionLevel.Optimal; }); services.Configure(options => { options.Level = CompressionLevel.Optimal; }); services.AddResponseCompression(options => { options.EnableForHttps = true; options.Providers.Add(); options.Providers.Add(); options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[] { "text/html; charset=utf-8", "application/xhtml+xml", "application/atom+xml", "image/svg+xml" }); }); } }