Parse http headers
HTTP header string parser.
HTTP/1.1 200 OKDate: Tue, 10 Jun 2014 07:19:27 GMTConnection: keep-aliveTransfer-Encoding: chunked
date: 'Tue, 10 Jun 2014 07:19:27 GMT'connection: 'keep-alive''transfer-encoding': 'chunked'
If you've ever needed to log or in another way access the headers sent
to the client on a
http.ServerResponse in Node.js, you know it's not
as easy as with the
http.IncomingMessage headers (which you just
Response headers are not directly available on the
Instead all headers are preprocessed as a string on the private
response._header property and needs to be processed in order to be
available as an object.
This module makes the task super simple.
npm install http-headers
var httpHeaders = require'http-headers';httpcreateServerresend'Hello World';console.log'The headers sent to the client was:' httpHeadersres;;