Skip to main content
IncomingMessage.prototype.headers - node__http.d.ts - Node documentation
property IncomingMessage.prototype.headers

Usage in Deno

```typescript import { IncomingMessage } from "node:node__http.d.ts"; ```
The request/response headers object. Key-value pairs of header names and values. Header names are lower-cased. ```js // 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`, or `user-agent` are discarded. To allow duplicate values of the headers listed above to be joined, use the option `joinDuplicateHeaders` in [request](../.././node__http.d.ts/~/request) and [createServer](../.././node__http.d.ts/~/createServer). See RFC 9110 Section 5.3 for more information. * `set-cookie` is always an array. Duplicates are added to the array. * For duplicate `cookie` headers, the values are joined together with `; `. * For all other headers, the values are joined together with `, `.

Type