stringify with arrayFormat: 'brackets' doesn't urlEncode the square brackets
It seems keys generated from arrays with arrayFormat: 'bracket' don't get urlEncoded:
stringify({ a: [1, 2, 3 ]}, { arrayFormat: 'bracket' }); => a[]=1&a[]=2&a[]=3
Why would they be?
From what I understood, they are not supposed to be in the URI unencoded? https://newbedev.com/is-array-syntax-using-square-brackets-in-url-query-strings-valid
"This is why, for example, it is not a violation of RFC 3986 when PHP accepts both unencoded and percent encoded square brackets as valid characters in a query string, and even assigns to them a special purpose. However, it would appear that authors who try to take advantage of this loophole by not percent encoding square brackets are in violation of RFC 3986."
i had same issue so use qs package and it works
Stringifying query parameter which includes brackets gives inconsistent result which mixes encoded and unencoded, so at least it better be consistent at least
const q = qs.stringify({ 'filter[product]': 'test', 'filter[id]': [1, 2, 3] }, { arrayFormat: 'bracket' })
console.log(q) // filter%5Bid%5D[]=1&filter%5Bid%5D[]=2&filter%5Bid%5D[]=3&filter%5Bproduct%5D=test