Currently, when passing an array to a query string parameter it is always stringified as a list separated by commas.
It is desirable that this behavior can be configured to use another array formats, such as in the query-string npm package
For doing this, a new configuration option called queryStringArrayFormat could be added:
import { Api } from "@data-provider/axios";
const myApi = new Api("/foo-url", {
queryStringArrayFormat: "none"
});
fooApi.query({
queryString: { foo: [1, 2, 3] }
}).read();
//=> 'foo=1,2'
Available formats could be the same than in the query-string npm package:
- 'bracket': Serialize arrays using bracket representation:
//=> 'foo[]=1&foo[]=2&foo[]=3'
- 'index': Serialize arrays using index representation:
//=> 'foo[0]=1&foo[1]=2&foo[3]=3'
- 'comma': Serialize arrays by separating elements with comma (default behavior until next major version for maintaining retrocompatibility):
- 'none': Serialize arrays by using duplicate keys (default behavior in next major version):