AutoWrapper icon indicating copy to clipboard operation
AutoWrapper copied to clipboard

Conditional response wrapping

Open Dubzer opened this issue 3 years ago • 1 comments

This middleware has options such as IgnoreWrapForOkRequests, ExcludePaths and WrapWhenApiPathStartsWith. But that still might not be enough. So in my opinion, it would be nice to have some more flexible tool to customize when to use AutoWrapper.

For example, Hellang.Middleware.ProblemDetails has setting IsProblem that accepts Func<HttpContext, bool>. This can cover almost all use cases. That's how I used it: config.IsProblem = context => context.Response.StatusCode is >= 400 and < 500;

Is it possible to add something like that?

Dubzer avatar Jun 30 '21 16:06 Dubzer

Thanks @Dubzer! Great suggestion and that's really something that we have to consider adding. I have so much on my plate now and hopefully, when time permits, I can start cleaning up the issues/requests and implement them. My top priority now is to port AW to support .NET 5 and 6. After that, I'll try to implement the suggestions from feedback. So, thank you! :)

proudmonkey avatar Jun 30 '21 19:06 proudmonkey