How to properly use UrlSearchParams to create a structure url like the following:
example.org?tag[]=one&tag[]=two&tag[]=other
When I use Url Params as below:
let params = new URLSearchParams(); params.append('tag', 'one'); params.append('tag', 'two'); params.append('tag', 'other');
Url is as follows:
example.org?tag=one&tag=two&tag=other
This approach causes some problems on web servers as they handle this query string in the same way as ?tag=one . The server receives only the first value if there are no brackets.
source share