We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node: v18.13.0 ufo: version 1.1.2
It might not depends on node version.
> const { stringifyQuery } = require('ufo') > stringifyQuery({ 'a': 'X', 'b[]': [], c: "Y" }) 'a=X&&c=Y'
If the parameter has an empty array as value, a double ampersand is generated and generated URL is invalid.
Expected behavior:
> stringifyQuery({ 'a': 'X', 'b[]': [], c: "Y" }) 'a=X&c=Y'
Especially, the "double ampersand" breaks my Nuxt/Rails hybrid application.
The behavior generates url like the following:
"https://localhost:3001/api/v1/users/search?page=1&perPage=25&sortBy=email-asc&&fullName=aaa;bbbb"
Ruby on Rails parses the query parameter as the following
{"page"=>"1", "per_page"=>"25", "sort_by"=>"email-asc", "full_name"=>"aaa", "bbbb"=>nil, "format"=>:json, "controller"=>"api/v1/users", "action"=>"search", "user"=>{}}
full_name=aaa;bbbb was separated to "full_name" => "aaa" and "bbbb" => '' and the value after semicolon is ignored in my search form.
full_name=aaa;bbbb
"full_name" => "aaa"
"bbbb" => ''
No response
The text was updated successfully, but these errors were encountered:
6e1ea34
Thanks for reporting issue. It will be fixed in next release.
Sorry, something went wrong.
data:
blob
No branches or pull requests
Environment
node: v18.13.0
ufo: version 1.1.2
It might not depends on node version.
Reproduction
Describe the bug
If the parameter has an empty array as value, a double ampersand is generated and generated URL is invalid.
Expected behavior:
Especially, the "double ampersand" breaks my Nuxt/Rails hybrid application.
The behavior generates url like the following:
Ruby on Rails parses the query parameter as the following
full_name=aaa;bbbb
was separated to"full_name" => "aaa"
and"bbbb" => ''
and the value after semicolon is ignored in my search form.Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: