Closed manoj-rp closed 2 years ago
I encountered the same problem. I locked version 6.9.6
Thanks for your reply. Unfortunately this module is being used by some other module. And I'm using that module for my usecase.
This isn’t a bug, it is intentional behavior so that stringifying will preserve the array-ness.
See #434
I have read the thread. But Shouldn't it be configurable?
Can we have another option along with arrayType
.
preserveArrayness: true/false
Because there can be usecases like
One can use qs
for stringifying it and may not be using it for parsing back again?
In our case,
We stringify it and pass the query string to an external service and that service doesn't use the qs
module to parse it back?
Any thoughts @ljharb
we run into the same issue with the new version.
not all APIs we are using are capable to handling query strings with brackets, they are expecting comma separated lists in all cases or no comma if it is only one value.
+1 for the additional option to toggle the "Arrayness" feature.
we have also just slammed into this issue. Tis causing a great deal of errors in production for us right now (we use QS to stringify params which are sent to an API - which does NOT support array bracket query string notation). 😭
for now, we'll just lock to 6.9.6
like the suggestion above.
Same here - I'd appreciate a configurable option.
I will plan on reverting the behavior by default, and adding an option to satisfy the original request.
I have overcome this issue temporarily by converting my arrays to length 2 when the actual length is 1
Example original array - [‘abc’] Transformed array- [‘abc’,’’]. Just added an empty element at the end. This solved my problem for now.
But it would be great if we can revert the recent change since many of the production applications are breaking.
On Wed, 15 Jun 2022 at 9:56 PM, Benjamin Shoemaker @.***> wrote:
Same here - I'd appreciate a configurable option.
— Reply to this email directly, view it on GitHub https://github.com/ljharb/qs/issues/442#issuecomment-1156682423, or unsubscribe https://github.com/notifications/unsubscribe-auth/AREQDQUMEP6P4YKEY22VUHTVPH747ANCNFSM5YIVZJXA . You are receiving this because you authored the thread.Message ID: @.***>
-- Manoj Kumar Richpanel.com
debug find this:
array.length === 1 use brackets
lock version
Same issue here. If this change is intentional, I suggest to consider it as a breaking change
Released in v6.11.0.
qs.stringify({ a: ['b'] }, { arrayFormat: 'comma' })
should return thea=b
.But it is returning the
repeat
type format -a%5B%5D=b ~ a[]=b
Below is the documentation and expected behaviour from readme
Below is the screenshot for the same
Can anyone help me if this is an issue or Am I missing something?