Closed MrDave1999 closed 11 months ago
The problem is this line: https://github.com/MrDave1999/SimpleResults/blob/95761227860a7309c9b65551476270d1f3440aea/src/AspNetCore/TranslateResultToHttpResultFilter.cs#L26-L28
By default, all values returned by controller actions are wrapped in a type called Microsoft.AspNetCore.Mvc.ObjectResult. This means that this condition will be false and the translator will never be called.
There is no benefit in resolving this issue. The endpoint filter called TranslateResultToHttpResult was created specifically for the Minimal APIs. For controller actions, you must use the attribute called TranslateResultToActionResult.
PR #50 only works if you use in Minimal API but in controller actions it does not work.
See https://learn.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis/min-api-filters?view=aspnetcore-8.0#register-a-filter-on-controller-actions