You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/08/14 10:07:38 UTC

[GitHub] [apisix] ccxhwmy opened a new issue, #7668: feat: As a user, I want to get a pretty json response body, so that i can read the response body handy

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: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tokers commented on issue #7668: feat: As a user, I want to get a pretty json response body, so that i can read the response body handy

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #7668:
URL: https://github.com/apache/apisix/issues/7668#issuecomment-1214349106

   @ccxhwmy Try to use the pipe with `python -mjson.tool` or `jq`.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] spacewander commented on issue #7668: feat: As a user, I want to get a pretty json response body, so that i can read the response body handy

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #7668:
URL: https://github.com/apache/apisix/issues/7668#issuecomment-1214355711

   It would be better to let other tools do the format job. Unix philosophy: do one thing and do it well.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] ccxhwmy commented on issue #7668: feat: As a user, I want to get a pretty json response body, so that i can read the response body handy

Posted by GitBox <gi...@apache.org>.
ccxhwmy commented on issue #7668:
URL: https://github.com/apache/apisix/issues/7668#issuecomment-1214527579

   I tryed [jq](https://stedolan.github.io/jq/) and it works well, thank you!


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] ccxhwmy closed issue #7668: feat: As a user, I want to get a pretty json response body, so that i can read the response body handy

Posted by GitBox <gi...@apache.org>.
ccxhwmy closed issue #7668: feat: As a user, I want to get a pretty json response body, so that i can read the response body handy
URL: https://github.com/apache/apisix/issues/7668


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org