Are HTTP headers case-sensitive?

后端 未结 8 2363
梦如初夏
梦如初夏 2020-11-22 03:03

In a blog post I use the following PHP to set the content-type of a response:

header(\'content-type: application/json; charset=utf-8\');

I

8条回答
  •  暖寄归人
    2020-11-22 03:09

    Header names are not case sensitive.

    From RFC 2616 - "Hypertext Transfer Protocol -- HTTP/1.1", Section 4.2, "Message Headers":

    Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive.

    The updating RFC 7230 does not list any changes from RFC 2616 at this part.

提交回复
热议问题