simen/queryparams — pull request #1 by edas (2012-08-09 19:26:44+00:00)
Title: Fix incorrect behaviour with arrays - adds index into brackets as side effect

Fix incorrect behaviour with arrays - adds index into brackets as side effect

QueryParams.encode({a: [{b:'c', d:'e'}, {b:'g'}]})
was giving "a[][b]=c&a[][d]=e&a[][b]=g"
wich is interpreted as "a[0][b]=c&a[1][d]=e&a[2][b]=g"
that is to say {a: [{ b:'c' }, {d:'e'}, {b:'g'}]}

With the fix, the out put will be "a[0][b]=c&a[0][d]=e&a[1][b]=g"
which maps correctly back to {a: [{b:'c', d:'e'}, {b:'g'}]}