Skip to content

Commit

Permalink
allow Infinity for parameterLimit, closes #23
Browse files Browse the repository at this point in the history
  • Loading branch information
nlf committed Aug 26, 2014
1 parent 07bb33e commit b147f46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/parse.js
Expand Up @@ -16,7 +16,7 @@ var internals = {
internals.parseValues = function (str, options) {

var obj = {};
var parts = str.split(options.delimiter, options.parameterLimit);
var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit);

for (var i = 0, il = parts.length; i < il; ++i) {
var part = parts[i];
Expand Down
6 changes: 6 additions & 0 deletions test/parse.js
Expand Up @@ -271,6 +271,12 @@ describe('#parse', function () {
done();
});

it('allows setting the parameter limit to Infinity', function (done) {

expect(Qs.parse('a=b&c=d', { parameterLimit: Infinity })).to.deep.equal({ a: 'b', c: 'd' });
done();
});

it('allows overriding array limit', function (done) {

expect(Qs.parse('a[0]=b&a[1]=c', { arrayLimit: 0 })).to.deep.equal({ a: { '0': 'b', '1': 'c' } });
Expand Down

0 comments on commit b147f46

Please sign in to comment.