-
-
Notifications
You must be signed in to change notification settings - Fork 454
Closed
Description
The docs of stringifyUrl method say:
Query items in the
queryproperty overrides queries in the url property
But internally when it parses the query from url, it ignores the parsing options passed to stringifyUrl (for example, arrayFormat). This leads to duplicate query keys in the final url.
For example:
const currentUrl = 'https://localhost:3000/?arr[]=item1';
const newUrl = qs.stringifyUrl(
{
url: currentUrl,
query: { arr: ['item1', 'item2'] },
},
{
arrayFormat: 'bracket',
skipEmptyString: true,
skipNull: true,
}
);The expected value is https://localhost:3000/?arr[]=item1&arr[]=item2.
But the final result is https://localhost:3000/?arr[]=item1&arr[]=item2&arr%5B%5D=item1.
Metadata
Metadata
Assignees
Labels
No labels