axios / axios-docs

Official documentation for the axios HTTP library
MIT License
147 stars 153 forks source link

Update paramsSerializer Documentation to Include Object Assignment with serialize and encode Fields #194

Open Gn0lee opened 3 months ago

Gn0lee commented 3 months ago

Describe the bug The current axios documentation on paramsSerializer is insufficient and does not cover the new method of assigning an object with serialize and encode fields. This omission leads to confusion as users cannot specify custom encoding when they assign a function to paramsSerializer, as it defaults to axios’ basic encoding.

To Reproduce Steps to reproduce the behavior:

  1. Refer to the current axios documentation on paramsSerializer.
  2. Assign a function to paramsSerializer in the axios configuration.
  3. Attempt to define custom encoding.
  4. Observe that the documentation does not explain how to properly assign paramsSerializer as an object with serialize and encode fields, leading to the issue where custom encoding cannot be specified.

Expected behavior The documentation should clearly explain that paramsSerializer needs to be assigned an object containing serialize and encode fields. This change should be highlighted to ensure users understand how to specify custom encoding correctly.

Screenshots

image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context To improve the documentation, a section should be added demonstrating the correct usage of paramsSerializer with an object. This should include examples and explanations of the serialize and encode fields, emphasizing the difference from the previous method of assigning a function directly. This update will help prevent confusion and ensure proper implementation of custom encoding.