ServiceStack 媒体类型

ServiceStack media type

我正在阅读 jsoiapi 文档

jsopi.org

谁能帮我理解这个

Server Responsibilities

Servers MUST send all JSON API data in response documents with the header Content-Type: application/vnd.api+json without any media type parameters.

Servers MUST respond with a 415 Unsupported Media Type status code if a request specifies the header Content-Type: application/vnd.api+json with any media type parameters.

Servers MUST respond with a 406 Not Acceptable status code if a request's Accept header contains the JSON API media type and all instances of that media type are modified with media type parameters.

Note: The content negotiation requirements exist to allow future versions of this specification to use media type parameters for extension negotiation and versioning.

我如何在 Servicestack 中实现这一点,我是否必须对以上内容持保留态度?

Servers MUST send all JSON API data in response documents with the header Content-Type: application/vnd.api+json without any media type parameters.

This can be done in AppHost by using DefaultContentType = MimeTypes.Json in the EndPointHostConfig

但是剩下的两个呢?

您可以通过多种方式 return different ContentTypes including registering a new Custom Media Type Format whilst the Error Handling 文档列出了多种不同的方式来 return 自定义 HTTP 错误响应。

但问题是,为什么要付出额外的努力来更改具有供应商前缀的 JSON 普遍接受的 Mime 类型? (导致现有浏览器和 JSON 客户端出现问题)。这只是一个学术练习还是意味着增加现实世界的价值?