mw.Uri: Add support for array parameters with explicit indexes
authorBartosz Dziewoński <matma.rex@gmail.com>
Tue, 27 Aug 2019 20:14:01 +0000 (22:14 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Tue, 27 Aug 2019 21:46:33 +0000 (21:46 +0000)
commit6a242023ca401b3c7ee9cdc68a2dffa6524fab3b
tree5d5dd7f6693454a46384b76174cea2f22d66eb52
parentc63a37679c8e96940702fa84e4def02484dd8e24
mw.Uri: Add support for array parameters with explicit indexes

When the new 'arrayParams' option is set, query strings like
`&foo[0]=a&foo[1]=b` will be parsed as a single parameter `foo`
containing an array, rather than two separate parameters.

The new option also affects the behavior of array parameters like
`&foo[]=a&foo[]=b`, which will be parsed as a parameter named `foo`
rather than `foo[]`, and disables array handling for parameters that
don't contain an array index at the end.

Unlike in PHP, this does not handle associative or multi-dimensional
arrays, but that may be improved in the future.

Bug: T231382
Change-Id: I48d4bb3fdf0ea7f5eb133c59bf63651ba356fc42
resources/src/mediawiki.Uri/Uri.js
tests/qunit/suites/resources/mediawiki/mediawiki.Uri.test.js