hg-pyun / axios-logger

Beautify Axios Logging Messages
MIT License
173 stars 33 forks source link

Show query params for GET requests #67

Closed reslear closed 3 years ago

reslear commented 4 years ago

add query params display for GET requests, and option for controlling.

await axios.get(`/wp-json/wp/v2/posts`, {
  params: {
    slug: "article",
   _fields: "id"
  }
}

image to: image

hg-pyun commented 4 years ago

@reslear Thank you for feedback. I will add soon.

FezVrasta commented 4 years ago

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.

reslear commented 4 years ago

@FezVrasta in my case now

Снимок экрана 2020-10-08 в 19 42 32

https://github.com/reslear/whale/blob/main/packages/axios-log/src/axios-log.ts

FezVrasta commented 4 years ago

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.

reslear commented 4 years ago

yes it's true, but this is temporary solution)

gurisko commented 4 years ago

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:

For the consistency I vote to use the params object from AxiosRequestConfig.

Webbrother commented 3 years ago

Please take a look at this PR: https://github.com/hg-pyun/axios-logger/pull/83

hg-pyun commented 3 years ago

It updated on 2.6.0 verison.