Returning HTTP 204 (No Content) from .NET Minimal API

added by DotNetKicks
4/14/2022 2:25:22 PM

261 Views

I recently converted some ASP.NET web api projects from using controllers to using minimal apis. And I ran into a weirdness. If you return "null" from a controller method, then the response is HTTP 204 (No Content), but if you return "null" from a minimal api, the response is HTTP 200 (OK) with the string "null" as the body.


0 comments