1
request

{
  params: {
    devices: ['iPad12,1', 'LH-12', 'LX-12']
  }
}

to send a devices query parameter with array, I reduced array to a string with comma. ('iPad12,1,LH-12,LX-12')

in this situation, if a device name has a comma(like iPad12,1), backend recognize this query patemeter like ['iPad12', '1', 'LH-12', 'LX-12'].

Is there the best way to solve this issue?

Jun
  • 21
  • 1
  • 7
  • Try encoding the params. https://stackoverflow.com/questions/1763508/passing-arrays-as-url-parameter – fractal397 Feb 18 '22 at 09:19
  • An idea would be to use [qs](https://www.npmjs.com/package/qs) - if multiple scenarios. Example: `qs.stringify(['iPad12,1', 'LH-12', 'LX-12'])` returns `"0=iPad12%2C1&1=LH-12&2=LX-12"` – tcconstantin Feb 18 '22 at 09:23

0 Answers0