Set more than one HTTP header with the same name?

后端 未结 5 2141
南旧
南旧 2020-12-23 19:19

As far as I know it is allowed by the HTTP spec to set more than one HTTP header with the same name. Is there any use case to do so (from client to server and vice versa)?

5条回答
  •  爱一瞬间的悲伤
    2020-12-23 20:05

    Old thread, but I was looking into this same issue. Anyway, the Accept and Accept-Encoding headers are typical examples that uses multiple values, comma separated. Even if these are request specific header, the specs do not differentiate between request and response at this level. Check the one from this page. What the spec says is that if you have commas as character in the value of the header, you cannot use multiple headers of the same name, unless you disambiguate the use of the comma.

提交回复
热议问题