* Returns an URLSearchParams as string. * Does handle spaces correctly.
(searchParams)
| 343 | * Does handle spaces correctly. |
| 344 | */ |
| 345 | function urlSearchParamsToString(searchParams) { |
| 346 | const rtn = [] |
| 347 | |
| 348 | searchParams.forEach((value, key) => { |
| 349 | if (value) { |
| 350 | rtn.push(key + '=' + encodeURIComponent(value)) |
| 351 | } else { |
| 352 | rtn.push(key) |
| 353 | } |
| 354 | }) |
| 355 | |
| 356 | return rtn.join('&') |
| 357 | } |
no test coverage detected