You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "piglei (via GitHub)" <gi...@apache.org> on 2023/05/24 07:34:30 UTC

[GitHub] [apisix] piglei commented on a diff in pull request #9482: feat: Inform user when request /plugins/reload/ using wrong HTTP methods

piglei commented on code in PR #9482:
URL: https://github.com/apache/apisix/pull/9482#discussion_r1203602268


##########
apisix/admin/init.lua:
##########
@@ -142,14 +162,8 @@ end
 
 
 local function run()
-    local api_ctx = {}
-    core.ctx.set_vars_meta(api_ctx)
-    ngx.ctx.api_ctx = api_ctx
-
-    local ok, err = check_token(api_ctx)
-    if not ok then
-        core.log.warn("failed to check token: ", err)
-        core.response.exit(401, {error_msg = "failed to check token"})
+    if not set_ctx_and_check_token() then

Review Comment:
   Thank you for pointing this out. I've updated the function to remove the value-returning logic, the function-call statements were updated as well.
   
   PS: After this modification, I'm thinking that if "set_ctx_and_check_token" is still a good name, because the name didn't imply that the request would exit. Maybe "exit_if_token_invalid" is a better name?



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