Meine Firma nutzt ein Standardformat für Health Antworten in internen apis etc. Wir entweder den Status mit dem Inhaltstyp application/status+json
auf Erfolg oder application/problem+json
zurück, wenn wir ein Problem (Teil this proposed spec) haben.Add unterstützte Kopftyp JsonOutputFormatter
Aber wenn ich den Inhaltstyp auf diese beiden setzt, wird meine Antwort zu einerAntwort.
Also, wie kann ich dem JsonOutputFormatter mitteilen, dass es diese Json-Header-Typen zu seiner SupportedMediaTypes
Sammlung hinzufügen kann?
Ich würde erwarten, ich so etwas wie tun könnte:
services.AddMvc().AddJsonOptions(jsonOptions => {
jsonOptions.SerializerSettings.SupportedMediaTypes.Add("application/problem+json");
});
Aber natürlich kann ich nicht einen Weg finden, zu tun.