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 2021/10/07 11:24:21 UTC

[GitHub] [apisix] spacewander commented on a change in pull request #5174: fix: refine admin API return JSON instead of code

spacewander commented on a change in pull request #5174:
URL: https://github.com/apache/apisix/pull/5174#discussion_r724087432



##########
File path: apisix/admin/init.lua
##########
@@ -278,12 +278,13 @@ local function post_reload_plugins()
     local ok, err = check_token(api_ctx)
     if not ok then
         core.log.warn("failed to check token: ", err)
-        core.response.exit(401)
+        core.response.exit(401, {error_msg="failed to check token"})
     end
 
     local success, err = events.post(reload_event, get_method(), ngx_time())
     if not success then
         core.response.exit(503, err)
+

Review comment:
       Extra blank line?

##########
File path: apisix/admin/init.lua
##########
@@ -192,13 +192,13 @@ local function run_stream()
     if not local_conf.apisix.stream_proxy then
         core.log.warn("stream mode is disabled, can not to add any stream ",
                       "route")
-        core.response.exit(400)
+        core.response.exit(400, {error_msg="stream mode is disabled, can not " ..

Review comment:
       "stream mode is disabled, can not add any stream route"

##########
File path: apisix/admin/init.lua
##########
@@ -192,13 +192,13 @@ local function run_stream()
     if not local_conf.apisix.stream_proxy then
         core.log.warn("stream mode is disabled, can not to add any stream ",

Review comment:
       Let's fix the grammar here in the next PR

##########
File path: apisix/admin/init.lua
##########
@@ -192,13 +192,13 @@ local function run_stream()
     if not local_conf.apisix.stream_proxy then
         core.log.warn("stream mode is disabled, can not to add any stream ",
                       "route")
-        core.response.exit(400)
+        core.response.exit(400, {error_msg="stream mode is disabled, can not " ..
+                                           "to add stream"})
     end
 
     local ok, err = check_token(api_ctx)
     if not ok then
-        core.log.warn("failed to check token: ", err)

Review comment:
       Let's keep the original error log




-- 
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