Describe the bug
Although there's a backport in #6227, in v0.28.0, the serializer isn't working as expected. This is because the v0.28.0 version of buildUrl (code) is simply only taking options.encode, not taking options.serializer into account:
|
var _encode = options && options.encode || encode; |
|
|
|
var serializerParams = utils.isURLSearchParams(params) ? |
|
params.toString() : |
|
new AxiosURLSearchParams(params, options).toString(_encode); |
|
|
|
if (serializerParams) { |
|
url += (url.indexOf('?') === -1 ? '?' : '&') + serializerParams; |
|
} |
This seems to be a refactor to match the v1.x version, because in v0.27.2 at least (code), it takes the paramSerializer function into account:
|
var serializedParams; |
|
if (paramsSerializer) { |
|
serializedParams = paramsSerializer(params); |
In order for #6227 to actually work, there needs to be a backport similar to #5113 towards v0.x
To Reproduce
- Set the version to v0.28.0
- Set the
paramsSerializer function
- It won't work
Code snippet
// Simply following https://axios-http.com/docs/req_config
axios.create({
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
})
Expected behavior
The parameters should be serialized, but it didn't
Axios Version
v0.28.0
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
No response
OS
No response
Additional Library Versions
No response
Additional context/Screenshots
No response
Describe the bug
Although there's a backport in #6227, in v0.28.0, the serializer isn't working as expected. This is because the v0.28.0 version of
buildUrl(code) is simply only takingoptions.encode, not takingoptions.serializerinto account:axios/lib/helpers/buildURL.js
Lines 36 to 44 in ce46346
This seems to be a refactor to match the v1.x version, because in v0.27.2 at least (code), it takes the
paramSerializerfunction into account:axios/lib/helpers/buildURL.js
Lines 28 to 30 in bc733fe
In order for #6227 to actually work, there needs to be a backport similar to #5113 towards v0.x
To Reproduce
paramsSerializerfunctionCode snippet
Expected behavior
The parameters should be serialized, but it didn't
Axios Version
v0.28.0
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
No response
OS
No response
Additional Library Versions
No response
Additional context/Screenshots
No response