5
Arayan kişinin bazı jsonlarını yayınladığı asp.net core mvc'de webhook yazıyorum. Ancak İçerik Türü application/vnd.myget.webhooks.v1+json
olarak ayarlanmıştır. Sadece bu içerik türü haritasını JsonInputFormatter
'a istiyorum. MediaType'ı varolan JsonInputFormatter'a ekleyin
ConfigureServices
services.Configure<MvcOptions>(options => {
options.InputFormatters.OfType<JsonInputFormatter>().First().SupportedMediaTypes.Add(
new MediaTypeHeaderValue("application/vnd.myget.webhooks.v1+json")
);
});
yılında varsayılan InputFormatter
değiştirebilir
services.AddMvc(mvcConfig =>
{
var formatter = new JsonInputFormatter();
formatter.SupportedMediaTypes.Add(
new MediaTypeHeaderValue("application/vnd.myget.webhooks.v1+json"));
mvcConfig.InputFormatters.Add(formatter);
});