AspNetCoreUnsupportedMediaType
The AspNetCoreUnsupportedMediaType package is an ASP.NET Core solution which requires all http requests to have the 'Content-Type' header set to 'application/json'.
NuGet install:
Install-Package AspNetCoreUnsupportedMediaType
Startup.cs code:
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc()
.AddMvcOptions(options =>
{
options.Filters.Add(typeof(UnsupportedMediaTypeResultFilter));
options.Filters.Add(typeof(ValidateUnsupportedMediaTypeFilterAttribute));
});
}