proudmonkey / AutoWrapper

A simple, yet customizable global exception handler and Http response wrapper for ASP.NET Core APIs.
MIT License
679 stars 82 forks source link

core using Microsoft.AspNetCore.ResponseCompression is invalid #59

Closed gthelp closed 4 years ago

gthelp commented 4 years ago

My service compresses results and I am trying to use autowrapper, but it wraps after the compression, so results look like:

{"message":"GET Request successful.","isError":false,"result":" \u0001\u0000 tM B

you can see the results are compressed, but it should be the entire json message. How can I move autowrapper to run before compression?

Thanks, Greg

gthelp commented 4 years ago

Solved it by changing the startup.cs sequence

app.UseResponseCompression(); app.UseApiResponseAndExceptionWrapper();