check_header
Advanced tools
Comparing version 1.0.4 to 1.1.0
@@ -7,4 +7,5 @@ // From NodeJS - https://github.com/nodejs/node/commit/2a2d3e1b0333441d1bd00def06d687f807067f6e | ||
// field-vchar = VCHAR / obs-text | ||
'use strict'; | ||
function checkInvalidHeaderChar(val) { | ||
val = '' + val; | ||
for (var i = 0; i < val.length; i++) { | ||
@@ -28,10 +29,10 @@ var ch = val.charCodeAt(i); | ||
if (headers.hasOwnProperty(property)) { | ||
if (checkInvalidHeaderChar(headers[property])===true) { | ||
return false; | ||
} | ||
if (checkIsHttpToken(property)===false) { | ||
return false; | ||
} | ||
if (checkInvalidHeaderChar(headers[property]) === true) { | ||
return false; | ||
} | ||
if (checkIsHttpToken(property) === false) { | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
return true; | ||
@@ -45,1 +46,2 @@ } | ||
}; | ||
//# sourceMappingURL=headers.map |
@@ -0,1 +1,4 @@ | ||
'use strict'; | ||
module.exports = require('./headers'); | ||
//# sourceMappingURL=index.map |
{ | ||
"name": "check_header", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "Check if headers aren't invalid for correct use in setHeader or writeHead functions", | ||
"main": "lib/", | ||
"scripts": { | ||
"test": "./node_modules/.bin/mocha" | ||
"test": "peasant test", | ||
"cover": "peasant cover", | ||
"lint": "peasant lint", | ||
"peasant": "peasant", | ||
"ci": "peasant -s lint test build", | ||
"prepublish": "npm run ci" | ||
}, | ||
@@ -17,6 +22,6 @@ "repository": { | ||
"keywords": [ | ||
"header", | ||
"http", | ||
"setHeader", | ||
"writeHead" | ||
"header", | ||
"http", | ||
"setHeader", | ||
"writeHead" | ||
], | ||
@@ -26,5 +31,7 @@ "author": "abtris", | ||
"devDependencies": { | ||
"mocha": "*", | ||
"chai": "*" | ||
"peasant": "0.5.2" | ||
}, | ||
"dependencies": { | ||
"babel-runtime": "6.5.0" | ||
} | ||
} |
@@ -10,12 +10,14 @@ [![npm version](https://badge.fury.io/js/check_header.svg)](https://badge.fury.io/js/check_header) | ||
npm install check_header | ||
```sh | ||
npm install --save check_header | ||
``` | ||
## Example | ||
var checker = require('check_header'); | ||
var headersObject = {'Content-Type':'žluťoučký kůň'}; | ||
if (!checker.isValid(headersObject)) { | ||
console.log("Invalid header there!"); | ||
} | ||
```js | ||
var checker = require('check_header'); | ||
var headersObject = {'Content-Type':'žluťoučký kůň'}; | ||
if (!checker.isValid(headersObject)) { | ||
console.log("Invalid header there!"); | ||
} | ||
``` |
Sorry, the diff of this file is not supported yet
7390
1
12
23
1
46
+ Addedbabel-runtime@6.5.0
+ Addedbabel-runtime@6.5.0(transitive)
+ Addedcore-js@1.2.7(transitive)