Priya Avanigadda

Priya Avanigadda

  • 1.9k
  • 82
  • 1.8k

Route specific response compression in dotnet core 2

Oct 4 2019 5:54 AM
Hi All,
I am doing the response compression using GZip provider, I wrote the below code in Startup.cs class 

services.AddResponseCompression(options =>
options.EnableForHttps = true;
services.Configure<GzipCompressionProviderOptions>(options =>
options.Level = CompressionLevel.Fastest;

By using the above code, for all API endpoints, the response will be compressed since I have added the above code in startup class, but I want to compress the response only for one endpoint rather compressing for all endpoints.
so can anyone help me how to do only for the specific API controller endpoint?

Brought to you by: JavaScript SDK for Bold BI dashboard and analytics embedding. Free trial.