5
Sto scrivendo un webhook in asp.net core mvc dove il chiamante pubblica alcuni json. Ma il Content-Type è impostato su application/vnd.myget.webhooks.v1+json
. Voglio solo avere questo tipo di contenuto map per il JsonInputFormatter
.Aggiungi MediaType a JsonInputFormatter esistente
ho fatto questo, ma chiedo se c'è un modo migliore:
services.AddMvc(mvcConfig =>
{
var formatter = new JsonInputFormatter();
formatter.SupportedMediaTypes.Add(
new MediaTypeHeaderValue("application/vnd.myget.webhooks.v1+json"));
mvcConfig.InputFormatters.Add(formatter);
});