message.headers
请求/响应头对象。
标头名称和值的键值对。 标头名称是小写的。
// 打印如下内容:
//
// { 'user-agent': 'curl/7.22.0',
// host: '127.0.0.1:8000',
// accept: '*/*' }
console.log(request.headers);原始标头中的重复项按以下方式处理,具体取决于标头名称:
- 重复的
age、authorization、content-length、content-type、etag、expires、from、host、if-modified-since、if-unmodified-since、last-modified、location、max-forwards、proxy-authorization、referer、retry-after、server或user-agent被丢弃。 set-cookie始终是数组。 重复项被添加到数组中。- 对于重复的
cookie标头,其值使用 '; ' 连接。 - 对于所有其他标头,其值使用 ', ' 连接。
The request/response headers object.
Key-value pairs of header names and values. Header names are lower-cased.
// Prints something like:
//
// { 'user-agent': 'curl/7.22.0',
// host: '127.0.0.1:8000',
// accept: '*/*' }
console.log(request.headers);Duplicates in raw headers are handled in the following ways, depending on the header name:
- Duplicates of
age,authorization,content-length,content-type,etag,expires,from,host,if-modified-since,if-unmodified-since,last-modified,location,max-forwards,proxy-authorization,referer,retry-after,server, oruser-agentare discarded. set-cookieis always an array. Duplicates are added to the array.- For duplicate
cookieheaders, the values are joined together with '; '. - For all other headers, the values are joined together with ', '.