Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Conversation

Joneser
Copy link
Contributor

@Joneser Joneser commented May 13, 2022

#117

The querystring lib is now deprecated and as a result no longer has active support.

Replacing its usage with the URLSearchParams which still receives active support.

@Joneser Joneser changed the title Migrate from legacy querystringto URLSearchParams Migrate from legacy querystring to URLSearchParams May 13, 2022
@oporkka
Copy link
Member

oporkka commented May 13, 2022

👍

@shuhei
Copy link
Contributor

shuhei commented May 13, 2022

Looks like new URLSearchParams(obj) doesn't support string[] as a param value. https://nodejs.org/api/url.html#new-urlsearchparamsobj

Unlike querystring module, duplicate keys in the form of array values are not allowed. Arrays are stringified using array.toString(), which simply joins all array elements with commas.

So, this is going to be a breaking change?

@ponimas
Copy link
Contributor

ponimas commented May 13, 2022

So, this is going to be a breaking change?

I would better mimic the old behavior, but it requires transformation into the array of arrays.

new URLSearchParams([["a", 1], ["a", 2]]).toString()
'a=1&a=2'

@Joneser Joneser closed this Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants