Closed reslear closed 3 years ago
@reslear Thank you for feedback. I will add soon.
Adding my request here, I'd love to see the final URL, with the serialized query params, unlike the example posted by the OP.
For example, I'd like to see:
[Request] 17:54:56 GET /wp-json/wp-v2-posts/?slug=article&_fields=id
so that it's easy to see the final URL hit by Axios.
@FezVrasta in my case now
https://github.com/reslear/whale/blob/main/packages/axios-log/src/axios-log.ts
The problem with this is that you are not logging what Axios will actually call, the way params are serialized to string may differ by the qs
options you provided.
yes it's true, but this is temporary solution)
I had a look into this one and there doesn't seem to be a consistent way on how to get URL with a query string:
AxiosRequestConfig
only contains params object (AxiosRequestConfig.params
),AxiosResponse
contains path
(URL with a query string) but it isn't well typed in axios
itself so I am not sure if we can rely on this (AxiosResponse.request.path
), it also contains params object (AxiosResponse.config.params
);AxiosError
same as AxiosResponse
(AxiosError.request.path
).For the consistency I vote to use the params object from AxiosRequestConfig
.
Please take a look at this PR: https://github.com/hg-pyun/axios-logger/pull/83
It updated on 2.6.0 verison.
add query params display for GET requests, and option for controlling.
to: