根据规范,HTTP Accept header 可以有多个值,如下所示:
Accept: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8
Source
我的问题是:接受具有多个值的 header 是否需要至少有一个权重?或者如果所有内容类型都没有权重,它们仍然有效吗?
换句话说,根据规范,这个 Accept header 仍然有效吗?
Accept: text/html, application/xhtml+xml, application/xml, */*
提前致谢!
最佳答案
质量值是可选的,但每个条目都有一个隐含的质量值 1。
https://developer.mozilla.org/en-US/docs/Glossary/Quality_values
The importance of a value is marked by the suffix ';q=' immediately followed by a value between 0 and 1 included, with up to three decimal digits, the highest value denoting the highest priority. When not present, the default value is 1.
关于http-headers - 具有多个值的 Accept Header 中是否需要权重值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50411962/