5
Ich schreibe einen Webhook in asp.net Core Mvc, wo der Anrufer einige JSON Posts. Der Inhaltstyp ist jedoch auf application/vnd.myget.webhooks.v1+json
festgelegt. Ich möchte nur diese Inhaltstypkarte zu JsonInputFormatter
haben.Hinzufügen MediaType zu bestehenden JsonInputFormatter
Ich tat dies, aber frage mich, ob es einen besseren Weg ist:
services.AddMvc(mvcConfig =>
{
var formatter = new JsonInputFormatter();
formatter.SupportedMediaTypes.Add(
new MediaTypeHeaderValue("application/vnd.myget.webhooks.v1+json"));
mvcConfig.InputFormatters.Add(formatter);
});