Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paramsSerializer is not working in v0.28.0 #6262

Closed
briwa opened this issue Feb 27, 2024 · 2 comments
Closed

paramsSerializer is not working in v0.28.0 #6262

briwa opened this issue Feb 27, 2024 · 2 comments

Comments

@briwa
Copy link

briwa commented Feb 27, 2024

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

@AlexSanin
Copy link

any workaround for this?

@briwa
Copy link
Author

briwa commented Mar 29, 2024

I think we can close this since #6263 is merged and v0.28.1. is released. See: 3021e0d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants