diff --git a/lib/querystring.js b/lib/querystring.js index b034635668faa8..d5d4f175b6bebf 100644 --- a/lib/querystring.js +++ b/lib/querystring.js @@ -209,19 +209,20 @@ QueryString.parse = QueryString.decode = function(qs, sep, eq, options) { return obj; } - qs = qs.split(sep); - var maxKeys = 1000; if (options && typeof options.maxKeys === 'number') { maxKeys = options.maxKeys; } - var len = qs.length; // maxKeys <= 0 means that we should not limit keys count - if (maxKeys > 0 && len > maxKeys) { - len = maxKeys; + if (maxKeys > 0) { + qs = qs.split(sep, maxKeys); + } else { + qs = qs.split(sep); } + var len = qs.length; + var decode = QueryString.unescape; if (options && typeof options.decodeURIComponent === 'function') { decode = options.decodeURIComponent;