unosquare / embedio

A tiny, cross-platform, module based web server for .NET
http://unosquare.github.io/embedio
Other
1.46k stars 176 forks source link

Make it easier to configure web API serialization #489

Closed rdeago closed 3 years ago

rdeago commented 3 years ago

Is your feature request related to a problem? Please describe.

In situations that call for different response serializer callbacks for web API modules, such as for example #486, the only way is to subclass WebApiModule. This is not what one might reasonably expect.

I find myself writing .WithSerializer(MyCallback) only to have Intellisense remind me that there's no such extension method on WebApiModule.

Describe the solution you'd like

WebApiModuleBase.Serializer should be configurable like any "normal" property, including via a fluent extension method.

Describe alternatives you've considered

The alternative is the status quo as described in https://github.com/unosquare/embedio/issues/486#issuecomment-696113482: subclass WebApiModule just for the sake of using a different serializer.

rdeago commented 3 years ago

Actually you can already specify a response serializer for a WebApiModule, either with a constructor parameter or using a fluent extension method.

Shame on me for overlooking that. Closing this issue now.