响应头包含多个键值对,用于传递额外的信息。常见的响应头包括:

  • Content-Type:响应体的数据类型。

  • Content-Length:响应体的长度(字节数)。

  • Set-Cookie:设置 Cookie

  • Cache-Control:缓存控制指令。

  • Location:用于重定向的 URL。

示例:

Content-Type: application/json

Content-Length: 34

reference

HTTP报文