Skip to content

Commit ba5f71d

Browse files
committed
e18e: migrate to native URLSearchParams
Instead of the query-string package Fixes e18e/ecosystem-issues#11
1 parent c5917a5 commit ba5f71d

File tree

3 files changed

+9
-84
lines changed

3 files changed

+9
-84
lines changed

package-lock.json

Lines changed: 0 additions & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
"form-data": "^4.0.0",
4545
"got": "^11.8.6",
4646
"hash.js": "^1.1.7",
47-
"query-string": "^7.1.3",
4847
"tunnel": "^0.0.6",
4948
"yargs": "^17.2.1"
5049
},

src/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
getStrictSsl,
2121
getRegionSubDomain,
2222
} from './utils';
23-
import queryString from 'query-string';
2423

2524
import {
2625
PROTOCOL_MAP,
@@ -600,7 +599,15 @@ export default class SauceLabs {
600599
* stringify queryParams if stringifyOptions exists within description
601600
*/
602601
const modifiedParams = description.stringifyOptions
603-
? queryString.stringify(body, description.stringifyOptions)
602+
? new URLSearchParams(
603+
Object.entries(body)
604+
.map(([key, value]) => {
605+
if (Array.isArray(value)) return value.map((v) => [key, v]);
606+
return [[key, value]];
607+
})
608+
.flat()
609+
.sort()
610+
).toString()
604611
: body;
605612

606613
/**

0 commit comments

Comments
 (0)