azzlack / Microsoft.AspNet.WebApi.MessageHandlers.Compression

Drop-in module for ASP.Net WebAPI that enables GZip and Deflate support
Apache License 2.0
194 stars 54 forks source link

Web API response compression not working once the threshold value is set #14

Closed santoshpatro closed 8 years ago

santoshpatro commented 9 years ago

Hi,

I used the nuget package Microsoft.AspNet.WebApi.MessageHandlers.Compression for implementing compression for the web api following the steps mentioned in the below link:

https://github.com/azzlack/Microsoft.AspNet.WebApi.MessageHandlers.Compression

If I do not setup the threshold and go with the default code details in the App_Start\WebApiConfig.cs:

config.MessageHandlers.Insert(0, new ServerCompressionHandler(new GZipCompressor(), new DeflateCompressor())); I see in the Fiddler that the response is getting compressed. But once I set the threshold value as per the advanced usage details :

config.MessageHandlers.Insert(0, new ServerCompressionHandler(4096, new GZipCompressor(), new DeflateCompressor())); I see in the Fiddler that the response is not getting compressed even if the Content-Length is more than 4096 bytes.

I am testing it using VS2013 premium and IIS express. Can any help me to know is there any else I am missing out anything else.

josunedesosa commented 9 years ago

Do you resolve this issue???

santoshpatro commented 8 years ago

I tested it and it is working as expected. Thanks for the fix :)