gpt4 book ai didi

http - "+"在HTTP Accept header 中意味着什么?

转载 作者:可可西里 更新时间:2023-11-01 16:48:36 26 4
gpt4 key购买 nike

如何理解这条记录:

Accept: application/vnd.my.api+json

我的意思是,这个“+”符号是标准化的(无论如何,我没有在规范中找到它),还是只是一种约定?

谢谢。

最佳答案

Accept header 指定可接受媒体类型的列表。媒体类型的“+xxx”部分称为后缀。它是对媒体类型定义的扩充,有助于指定该媒体类型的底层结构。

RFC 6838 , 《4.2.8. 结构化语法名称后缀》定义:

XML in MIME [RFC3023] defined the first such augmentation to the
media type definition to additionally specify the underlying
structure of that media type. To quote:

  This document also standardizes a convention (using the suffix
'+xml') for naming media types ... when those media types
represent XML MIME (Multipurpose Internet Mail Extensions)
entities.

That is, it specified a suffix (in that case, "+xml") to beappended to the base subtype name.

Since this was published, the de facto practice has arisen forusing this suffix convention for other well-known structuringsyntaxes. In particular, media types have been registered withsuffixes such as "+der", "+fastinfoset", and "+json". Thisspecification formalizes this practice and sets up a registry forstructured type name suffixes.

The primary guideline for whether a structured type name suffix isregistrable is that it be described by a readily available
description, preferably within a document published by an establishedstandards-related organization, and for which there's a reference
that can be used in a Normative References section of an RFC.

Media types that make use of a named structured syntax SHOULD usethe appropriate registered "+suffix" for that structured syntaxwhen they are registered. By the same token, media types MUST NOTbe given names incorporating suffixes for structured syntaxes theydo not actually employ. "+suffix" constructs for as-yetunregistered structured syntaxes SHOULD NOT be used, given thepossibility of conflicts with future suffix definitions.

关于http - "+"在HTTP Accept header 中意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32757887/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com