I am writing a webhook in asp.net core mvc where the caller sends a json message. But Content-Type is set to application/vnd.myget.webhooks.v1+json . I just want this content type map to be in JsonInputFormatter .
I did this, but I wonder if there is a better way:
services.AddMvc( mvcConfig => { var formatter = new JsonInputFormatter(); formatter.SupportedMediaTypes.Add( new MediaTypeHeaderValue("application/vnd.myget.webhooks.v1+json") ); mvcConfig.InputFormatters.Add( formatter ); });
source share