ccxhwmy opened a new issue, #7668:
URL: https://github.com/apache/apisix/issues/7668

   ### Description
   
   Hi~
   As a user, I want to get the pretty json response, so that i can read the 
result handy.
   If i send a request to APISIX, it's response body like:
   ```shell
   ✗ curl "http://127.0.0.1:9080/apisix/admin/upstreams"; -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -v
   * About to connect() to 127.0.0.1 port 9080 (#0)
   *   Trying 127.0.0.1...
   * Connected to 127.0.0.1 (127.0.0.1) port 9080 (#0)
   > GET /apisix/admin/upstreams HTTP/1.1
   > User-Agent: curl/7.29.0
   > Host: 127.0.0.1:9080
   > Accept: */*
   > X-API-KEY: edd1c9f034335f136f87ad84b625c8f1
   > 
   < HTTP/1.1 200 OK
   < Date: Sun, 14 Aug 2022 09:54:52 GMT
   < Content-Type: application/json
   < Transfer-Encoding: chunked
   < Connection: keep-alive
   < Server: APISIX/2.15.0
   < Access-Control-Allow-Origin: *
   < Access-Control-Allow-Credentials: true
   < Access-Control-Expose-Headers: *
   < Access-Control-Max-Age: 3600
   < X-API-VERSION: v2
   < 
   
{"count":1,"action":"get","node":{"key":"\/apisix\/upstreams","dir":true,"nodes":[{"modifiedIndex":200,"key":"\/apisix\/upstreams\/1","createdIndex":200,"value":{"hash_on":"vars","pass_host":"pass","nodes":{"127.0.0.2:1":1,"127.0.0.1:1":1,"127.0.0.3:1":1},"create_time":1659234120,"type":"roundrobin","retries":2,"update_time":1659234120,"id":"1","scheme":"http"}}]}}
   ```
   I think it is hard to read the response body above
   it is better to response like:
   ```shell
   ✗ curl "http://127.0.0.1:9080/apisix/admin/upstreams"; -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -v
   * About to connect() to 127.0.0.1 port 9080 (#0)
   *   Trying 127.0.0.1...
   * Connected to 127.0.0.1 (127.0.0.1) port 9080 (#0)
   > GET /apisix/admin/upstreams HTTP/1.1
   > User-Agent: curl/7.29.0
   > Host: 127.0.0.1:9080
   > Accept: */*
   > X-API-KEY: edd1c9f034335f136f87ad84b625c8f1
   > 
   < HTTP/1.1 200 OK
   < Date: Sun, 14 Aug 2022 09:54:52 GMT
   < Content-Type: application/json
   < Transfer-Encoding: chunked
   < Connection: keep-alive
   < Server: APISIX/2.15.0
   < Access-Control-Allow-Origin: *
   < Access-Control-Allow-Credentials: true
   < Access-Control-Expose-Headers: *
   < Access-Control-Max-Age: 3600
   < X-API-VERSION: v2
   < 
   {
       "count":1,
       "action":"get",
       "node":{
           "key":"\/apisix\/upstreams",
           "dir":true,
           "nodes":[
               {
                   "modifiedIndex":200,
                   "key":"\/apisix\/upstreams\/1",
                   "createdIndex":200,
                   "value":{
                       "hash_on":"vars",
                       "pass_host":"pass",
                       "nodes":{
                           "127.0.0.2:1":1,
                           "127.0.0.1:1":1,
                           "127.0.0.3:1":1
                       },
                       "create_time":1659234120,
                       "type":"roundrobin",
                       "retries":2,
                       "update_time":1659234120,
                       "id":"1",
                       "scheme":"http"
                   }
               }
           ]
       }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to