Skip to content

Commit 4b3f43e

Browse files
feat: Add GZIP options
1 parent 958779e commit 4b3f43e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/GettingThingsDone.WebApi/Startup.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
using Newtonsoft.Json;
2020
using Newtonsoft.Json.Serialization;
2121
using Newtonsoft.Json.Converters;
22+
using Microsoft.AspNetCore.ResponseCompression;
23+
using System.IO.Compression;
2224

2325
namespace GettingThingsDone.WebApi
2426
{
@@ -100,6 +102,11 @@ public void ConfigureServices(IServiceCollection services)
100102

101103
// Turn on default GZIP compression.
102104
services.AddResponseCompression();
105+
// Set GZIP options
106+
services.Configure<GzipCompressionProviderOptions>(options =>
107+
{
108+
options.Level = CompressionLevel.Optimal; // Max reduce more CPU work
109+
});
103110
}
104111

105112
public void Configure(IApplicationBuilder app, IHostingEnvironment env)

0 commit comments

Comments
 (0)