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

Add full URL with serialized query parameters to history #311

Open
sean256 opened this issue Aug 11, 2021 · 2 comments
Open

Add full URL with serialized query parameters to history #311

sean256 opened this issue Aug 11, 2021 · 2 comments

Comments

@sean256
Copy link

sean256 commented Aug 11, 2021

I've run into a case where I needed to customize axio's paramsSerializer to change the default handling of array serialization.

It would be super if we could test for proper param serialization with this mock adapter.

My suggestion would be to add a new fullUrl to the history entries which includes the serialized parameters.

@bdsoha
Copy link
Contributor

bdsoha commented Dec 20, 2022

@sean256 I second that!

@bdsoha
Copy link
Contributor

bdsoha commented Dec 20, 2022

After a second look, I noticed that the history object is returning a native axios object that does not have a fullUrl equivalent parameter.

history: { [method: string]: AxiosRequestConfig[] };

Solution

Instead of basing my tests on the generated output of a custom paramsSerializer, I added assertions for the params passed in object form to the request.

In addition, I extracted the value of the paramsSerializer function and separately added a full series of tests at the unit-level.

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