Skip to content

Commit 0afab0f

Browse files
committed
fix: Revert "replace qs node API with URLSearchParams web api" (#485)
This reverts commit 8020f4e. URLSearchParams does not stringify nested objects
1 parent d8bcbb8 commit 0afab0f

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

package-lock.json

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

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
"fast-copy": "^2.1.7",
5252
"lodash.isplainobject": "^4.0.6",
5353
"lodash.isstring": "^4.0.1",
54-
"p-throttle": "^4.1.1"
54+
"p-throttle": "^4.1.1",
55+
"qs": "^6.11.2"
5556
},
5657
"devDependencies": {
5758
"@babel/cli": "^7.12.8",

src/create-http-client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { AxiosRequestHeaders } from 'axios'
22
import type { AxiosStatic } from 'axios'
33
import copy from 'fast-copy'
44
import asyncToken from './async-token'
5+
import qs from 'qs'
56

67
import rateLimitRetry from './rate-limit'
78
import rateLimitThrottle from './rate-limit-throttle'
@@ -96,10 +97,9 @@ export default function createHttpClient(
9697
maxBodyLength: config.maxBodyLength,
9798
paramsSerializer: {
9899
serialize: (params) => {
99-
return params ? new URLSearchParams(params).toString() : ''
100+
return qs.stringify(params)
100101
},
101102
},
102-
103103
// Contentful
104104
logHandler: config.logHandler,
105105
responseLogger: config.responseLogger,

0 commit comments

Comments
 (0)