I am building a web application using ASP.NET Core 3.1 as the back-end and Ember JS Octane as the front-end. Since Ember uses the JSON:API specificaiton, it sends requests with a content-type of application/vnd.api+json
. Apparently, the only way to get ASP.NET Core to accept this content-type is to use the 3rd party JsonApiDotNetCore library: https://github.com/json-api-dotnet/JsonApiDotNetCore
It seems really odd that ASP.NET Core would not support this media type out of the box considering there are project templates for creating web-APIs on ASP.NET Core that are bundled with either React or Angular front-end frameworks that I believe would use this media-type. Does anyone have any idea why this is the case? I have not found any information online that explains this.
As an alternative, can I create a custom formatter that both accepts and sends this media-type format or will I need to modify Ember to use application/json
? If yes, how?
This question is related to: ASP.NET Core 3.1 How can I get the controller to use System.Text.Json to serialize and deserialize
Related info:
- https://docs.microsoft.com/en-us/aspnet/core/web-api/advanced/formatting?view=aspnetcore-3.1
- https://jsonapi.org/format/
Aucun commentaire:
Enregistrer un commentaire