You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by me...@apache.org on 2020/03/25 23:23:31 UTC

[incubator-apisix] branch master updated: change: code style in lua/apisix.lua and t/plugin/proxy-mirror.t (#1339)

This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 5970b50  change: code style in lua/apisix.lua and t/plugin/proxy-mirror.t (#1339)
5970b50 is described below

commit 5970b50568289166daf19076672ba932a651b3e4
Author: dabue <53...@users.noreply.github.com>
AuthorDate: Thu Mar 26 07:23:19 2020 +0800

    change: code style in lua/apisix.lua and t/plugin/proxy-mirror.t (#1339)
---
 lua/apisix.lua          | 14 ++++++--------
 t/plugin/proxy-mirror.t |  8 ++++----
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/lua/apisix.lua b/lua/apisix.lua
index 45438e5..2bd2184 100644
--- a/lua/apisix.lua
+++ b/lua/apisix.lua
@@ -453,21 +453,19 @@ function _M.http_log_phase()
     end
 
     if router.global_rules and router.global_rules.values
-       and #router.global_rules.values > 0 then
-        local local_plugins = api_ctx.plugins
-        api_ctx.plugins = nil
+       and #router.global_rules.values > 0
+    then
         local plugins = core.tablepool.fetch("plugins", 32, 0)
         for _, global_rule in ipairs(router.global_rules.values) do
             core.table.clear(plugins)
-            api_ctx.plugins = plugin.filter(global_rule, plugins)
-            run_plugin("log")
+            plugins = plugin.filter(global_rule, plugins)
+            run_plugin("log", plugins, api_ctx)
         end
-
-        api_ctx.plugins = local_plugins
         core.tablepool.release("plugins", plugins)
     end
 
-    run_plugin("log")
+    run_plugin("log", nil, api_ctx)
+
     if api_ctx.uri_parse_param then
         core.tablepool.release("uri_parse_param", api_ctx.uri_parse_param)
     end
diff --git a/t/plugin/proxy-mirror.t b/t/plugin/proxy-mirror.t
index 728b6a6..1425fc9 100644
--- a/t/plugin/proxy-mirror.t
+++ b/t/plugin/proxy-mirror.t
@@ -203,7 +203,7 @@ passed
 
 
 
-=== TEST 4: sanity check (include uri)
+=== TEST 5: sanity check (include uri)
 --- config
        location /t {
            content_by_lua_block {
@@ -242,7 +242,7 @@ qr/failed to check the configuration of plugin proxy-mirror/
 
 
 
-=== TEST 5: sanity check (normal case)
+=== TEST 6: sanity check (normal case)
 --- config
        location /t {
            content_by_lua_block {
@@ -280,7 +280,8 @@ passed
 [error]
 
 
-=== TEST 6: hit route
+
+=== TEST 7: hit route
 --- request
 GET /hello
 --- error_code: 200
@@ -288,4 +289,3 @@ GET /hello
 hello world
 --- error_log
 uri: /hello
-