本文介绍了将单个 HTTP 标头的多个值添加到请求或响应的标准的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
If I want to add a list of values as an HTTP Header, is there a standard way to do this? I couldn't find anything (that I could easily understand) in RFC 822. For example, iscomma separated values standard or semi-colon separated values. Is there a standard at all?
Example:
Key: value1;value2;value3
解决方案
You'll want to take a look at the HTTP spec RFC 2616 where it says:
What this means is that you can send the same header multiple times in a response with different values, as long as those values can be appended to each other using a comma. This also means that you can send multiple values in a single header by concatenating them with commas.
So in your case it will be:
Key: value1,value2,value3
这篇关于将单个 HTTP 标头的多个值添加到请求或响应的标准的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!