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



##########
File path: apisix/plugin.lua
##########
@@ -299,18 +299,33 @@ local function trace_plugins_info_for_debug(plugins)
         core.table.insert(t, plugins[i].name)
     end
     if is_http and not ngx.headers_sent then
-        core.response.add_header("Apisix-Plugins", core.table.concat(t, ", "))
+        if ctx then
+            local debug_headers = ctx.debug_headers
+            if debug_headers then
+                if type(t) == "string" then
+                    core.table.insert(debug_headers, t)
+                end
+                if type(t) == "table" then
+                    for i, v in ipairs(t) do
+                        core.table.insert(debug_headers, v)

Review comment:
       Why not use a hash?

##########
File path: t/debug/debug-mode.t
##########
@@ -238,11 +238,9 @@ passed
 GET /hello
 --- yaml_config eval: $::yaml_config
 --- response_headers
-Apisix-Plugins: response-rewrite, limit-conn, limit-count, response-rewrite, 
response-rewrite
+Apisix-Plugins: response-rewrite, limit-conn, limit-count
 --- response_body
 yes
---- error_log

Review comment:
       We still need to check the `core.log.warn("Apisix-Plugins: ", 
core.table.concat(t, ", "))`

##########
File path: apisix/plugin.lua
##########
@@ -299,18 +299,33 @@ local function trace_plugins_info_for_debug(plugins)
         core.table.insert(t, plugins[i].name)
     end
     if is_http and not ngx.headers_sent then
-        core.response.add_header("Apisix-Plugins", core.table.concat(t, ", "))
+        if ctx then
+            local debug_headers = ctx.debug_headers
+            if debug_headers then
+                if type(t) == "string" then

Review comment:
       t is always a table




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