mirror of
https://github.com/tenrok/axios.git
synced 2026-06-14 18:42:33 +03:00
Fix: Don't add null values to query string. (#5108)
* feat: add boolean flag to mimic pre 1.x behavior for paramsSerializer custom function * chore: update ParamsSerializer Readme * fix: dont slice hash off URL if not appending params * Omit nulls from formData serialization * fix: dont add nulls or undefined values to arrays either * readme update * fix test * chore: documentation * chore: do TS properly Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
committed by
GitHub
parent
ef1c48a476
commit
b0ebf9fcac
@@ -358,6 +358,8 @@ These are the available config options for making requests. Only the `url` is re
|
||||
|
||||
// `paramsSerializer` is an optional config in charge of serializing `params`
|
||||
paramsSerializer: {
|
||||
encode?: (param: string): string => { /* Do custom ops here and return transformed string */ }, // custom encoder function; sends Key/Values in an iterative fashion
|
||||
serialize?: (params: Record<string, any>, options?: ParamsSerializerOptions ), // mimic pre 1.x behavior and send entire params object to a custom serializer func. Allows consumer to control how params are serialized.
|
||||
indexes: false // array indexes format (null - no brackets, false (default) - empty brackets, true - brackets with indexes)
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user