body-parser
Advanced tools
Comparing version 1.9.3 to 1.10.0
@@ -0,1 +1,6 @@ | ||
1.10.0 / 2014-12-02 | ||
=================== | ||
* make internal `extended: true` array limit dynamic | ||
1.9.3 / 2014-11-21 | ||
@@ -2,0 +7,0 @@ ================== |
@@ -113,9 +113,6 @@ /*! | ||
var opts = { | ||
arrayLimit: 100, | ||
parameterLimit: parameterLimit | ||
} | ||
return function queryparse(body) { | ||
var paramCount = parameterCount(body, parameterLimit) | ||
return function queryparse(body) { | ||
if (overlimit(body, parameterLimit)) { | ||
if (paramCount === undefined) { | ||
var err = new Error('too many parameters') | ||
@@ -126,3 +123,8 @@ err.status = 413 | ||
return parse(body, opts) | ||
var arrayLimit = Math.max(100, paramCount) | ||
return parse(body, { | ||
arrayLimit: arrayLimit, | ||
parameterLimit: parameterLimit | ||
}) | ||
} | ||
@@ -132,3 +134,3 @@ } | ||
/** | ||
* Determine if the parameter count is over the limit. | ||
* Count the number of parameters, stopping once limit reached | ||
* | ||
@@ -140,7 +142,3 @@ * @param {string} body | ||
function overlimit(body, limit) { | ||
if (limit === Infinity) { | ||
return false | ||
} | ||
function parameterCount(body, limit) { | ||
var count = 0 | ||
@@ -154,7 +152,7 @@ var index = 0 | ||
if (count === limit) { | ||
return true | ||
return undefined | ||
} | ||
} | ||
return false | ||
return count | ||
} | ||
@@ -204,3 +202,5 @@ | ||
return function queryparse(body) { | ||
if (overlimit(body, parameterLimit)) { | ||
var paramCount = parameterCount(body, parameterLimit) | ||
if (paramCount === undefined) { | ||
var err = new Error('too many parameters') | ||
@@ -207,0 +207,0 @@ err.status = 413 |
{ | ||
"name": "body-parser", | ||
"description": "Node.js body parsing middleware", | ||
"version": "1.9.3", | ||
"version": "1.10.0", | ||
"contributors": [ | ||
@@ -23,2 +23,3 @@ "Douglas Christopher Wilson <doug@somethingdoug.com>", | ||
"istanbul": "0.3.2", | ||
"methods": "~1.1.0", | ||
"mocha": "~2.0.0", | ||
@@ -25,0 +26,0 @@ "supertest": "~0.15.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30719
4
569