diff --git a/lib/types/urlencoded.js b/lib/types/urlencoded.js index 687745f8..f2488344 100644 --- a/lib/types/urlencoded.js +++ b/lib/types/urlencoded.js @@ -208,19 +208,9 @@ function getCharset (req) { */ function parameterCount (body, limit) { - var count = 0 - var index = 0 + var len = body.split('&').length - while ((index = body.indexOf('&', index)) !== -1) { - count++ - index++ - - if (count === limit) { - return undefined - } - } - - return count + return len > limit ? undefined : len - 1 } /** diff --git a/package.json b/package.json index 16ff7df7..c2734d21 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "lint": "eslint .", "test": "mocha --reporter spec --check-leaks test/", "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", - "test-cov": "nyc --reporter=html --reporter=text npm test" } }