Wrong query serialialization of defaultParams
See original GitHub issueHey, thanks for a great lib, I found that query serialization is broken at least with defaultParams if empty arrays are presented. here is the object I use:
defaultParams: {
a: 'string',
b: [],
c: [],
d: [1, 2],
}
and I’m getting following query ?a=string&&&d=1&d=2
as you might see there is additional &
symbols for removed empty params.
It getting worse after reload, because in this case route cant parse this query string correctly.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Default params serialisation behaviour incompatible ... - GitHub
Summary Given the default params serialisation behaviour, axios out-of-the-box may fail to work with recent Tomcat versions out-of-the-box.
Read more >Android retrofit jackson wrong query parameter serialization if ...
For example, I have an enum object FruitEnum.FRUIT : enum class FruitEnum { @JsonProperty("fruit") FRUIT }. which I want to pass as query...
Read more >Parameter Serialization - Swagger
Possible styles depend on the parameter location – path, query, header or cookie. ... The default serialization method is style: simple and explode:...
Read more >Serialization
To use Query & Analysis other than in Demonstration Mode, you must enter your serialization details for all installed Query & Analysis products...
Read more >serialize-query-params - npm
A library for simplifying encoding and decoding URL query parameters.. Latest version: 2.0.2, last published: 2 months ago.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Just a thought about tricky moment here, without brackets we cant be sure when
foo=bar
is a{ foo: bar }
or if it a{ foo: ['bar'] }
, so maybe we need a configuration option? to serialize arrays in more explicit way,foo[]=bar
orfoo[0]=bar
? hmm, a link to consider https://github.com/sindresorhus/query-string#arrayformat-1Hi, @troch I was thinking about this issue, the way you mention in last comment isnt really suitable for me because params might change. But what if route config will accept custom
parse
/serialize
(encode
/decode
) function? Then we will have flexible way to control query params on our own, anyone will be able to take any 3rd party lib he like for parsing/serialization queries or wrtite something specific when needed. Or maybe there is middleware for that?