31 lines
		
	
	
		
			959 B
		
	
	
	
		
			C#
		
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			959 B
		
	
	
	
		
			C#
		
	
	
| using Microsoft.AspNetCore.Builder;
 | |
| using Microsoft.AspNetCore.ResponseCompression;
 | |
| using Microsoft.Extensions.DependencyInjection;
 | |
| using System.IO.Compression;
 | |
| 
 | |
| namespace IRaCIS.Core.API
 | |
| {
 | |
|     public static class ResponseCompressionSetup
 | |
|     {
 | |
|         public static void AddResponseCompressionSetup(this IServiceCollection services)
 | |
|         {
 | |
|             services.AddResponseCompression(options =>
 | |
|             {
 | |
|                 options.EnableForHttps = true;
 | |
|                 options.Providers.Add<BrotliCompressionProvider>();
 | |
|                 options.Providers.Add<GzipCompressionProvider>();
 | |
|             });
 | |
| 
 | |
|             services.Configure<BrotliCompressionProviderOptions>(options =>
 | |
|             {
 | |
|                 options.Level = CompressionLevel.Optimal;
 | |
|             });
 | |
| 
 | |
|             services.Configure<GzipCompressionProviderOptions>(options =>
 | |
|             {
 | |
|                 options.Level = CompressionLevel.Optimal;
 | |
|             });
 | |
|         }
 | |
|     }
 | |
| }
 |