The `http-headers` package provides a utility to parse HTTP request and response start-lines and headers into a structured JavaScript object. It can process raw string or Buffer data containing complete HTTP messages, or directly extract and parse headers from Node.js `http.ServerResponse` objects. Key features include automatic body detection and ignored parsing, RFC 2068 compliance, and support for multi-line and repeating headers. The current stable version is 3.0.2. This package appears to be unmaintained; its last update was several years ago, meaning it does not receive active development, bug fixes, or compatibility updates for newer Node.js versions or HTTP standards (e.g., HTTP/2, HTTP/3). Its primary differentiator was simplifying the extraction of response headers from Node's internal `_header` property, which was not easily accessible otherwise.
npm install http-headersVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to use `http-headers` to parse and access the response headers directly from an `http.ServerResponse` object in a Node.js server, a key use case for this library.
Consider migrating to an actively maintained HTTP parsing library or implement robust custom parsing for critical headers. Evaluate the security implications carefully if continued use is unavoidable.
Ensure your project is configured to use CommonJS for this dependency, or wrap it in a custom ES module if necessary. For ESM-only projects, evaluate modern alternatives.
Monitor for compatibility issues with new Node.js releases. If breakage occurs, manual header construction or a different approach for accessing response headers might be necessary.
Use CommonJS `require` syntax instead: `const httpHeaders = require('http-headers');`Ensure you are assigning the result of `require('http-headers')` directly to a variable and then calling it: `const parser = require('http-headers'); parser(data);`Verify that the `data` argument is either a string, a Buffer containing HTTP message data, or an instance of Node.js `http.ServerResponse`.
No dependency data recorded yet.