Closed jherven closed 9 months ago
Thanks @jherven - have you verified this is the same behavior as on ASP.NET Framework? If so, would you be willing to submit a PR?
Yes, for the scenarios I tested this change better mimics ASP.NET framework. PR created #450 .
Summary
Using this library in a dotnet core application forcefully adds content-type "text/html" (when not set) even if there's no content. This isn't always desired and I think it's neither expected when there is no content for the response.
Motivation and goals
Risks / unknowns
If somebody already using this library relies on this header always being set this change may break something
Detailed design
The change I've done for now is very simple.
src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SetDefaultResponseHeadersMiddleware.cs -> WriteDefaultContentType
Added new criteria "hasContent"