simple-headers
v0.0.1
Published
Parse request headers to JSON or stringify them.
Downloads
2
Maintainers
Readme
simple-headers
Parse and serialize http headers.
To use
- Install it:
```bash
$ npm i simple-headers
```
- Require it and use:
```js
var simpleHeaders = require('simple-headers');
```
Example
var simpleHeaders = require('simple-headers');
var headerObject = {
'content-type': 'text/html;',
'cache-control': 'no-cache'
};
var serial = simpleHeaders.stringify(headerObject);
// "Content-Type: text/html;\r\nCache-Control: no-cache\r\n"
simpleHeaders.parse(serial);
// {
// 'content-type': 'text/html;',
// 'cache-control': 'no-cache'
// }
License
MIT © 2015 Sunny (darkowlzz)