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
backport: custom params serializer support for v0.x #6263
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,8 @@ const config: AxiosRequestConfig = { | |
params: { id: 12345 }, | ||
paramsSerializer: { | ||
indexes: true, | ||
encode: (value) => value | ||
encode: (value) => value, | ||
serialize: (value, options) => String(value) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @briwa, I noticed the Note: In v1.x, the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JadeMugs Thanks, I missed it. I just added them |
||
}, | ||
data: { foo: 'bar' }, | ||
timeout: 10000, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid defining
hashmarkIndex
also whenserializedParams
in a falsy value, these linecan be moved inside the if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JadeMugs I disagree. I don't think it matters much since the
hashMark
part of the code is only to strip out the URL. Besides, I'm following the version in #5113 here:https://github.com/DigitalBrainJS/axios/blob/92f0758429541b05c614dc25bc712379d8a41dbd/lib/helpers/buildURL.js#L39-L57