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 2020/09/27 01:48:16 UTC

[GitHub] [apisix] ShiningRush commented on a change in pull request #2271: bugfix: avoid overwriting Vary header in cors plugin

ShiningRush commented on a change in pull request #2271:
URL: https://github.com/apache/apisix/pull/2271#discussion_r493248897



##########
File path: apisix/core/response.lua
##########
@@ -97,19 +103,43 @@ function _M.set_header(...)
             error("should be a table if only one argument", 2)
         end
 
-        for k, v in pairs(headers) do
-            ngx_header[k] = v
+        if append then
+            for k, v in pairs(headers) do
+                ngx_add_header(k, v)
+            end
+
+        else
+            for k, v in pairs(headers) do
+                ngx_header[k] = v
+            end

Review comment:
       I think we can make it more clear:
   ```
   for k, v in pairs(headers) do
       if append then
           ngx_add_header(k, v)
       else
           ngx_header[k] = v
       end
   end
   ```
   How do you think?

##########
File path: apisix/core/response.lua
##########
@@ -85,7 +91,7 @@ function _M.say(...)
 end
 
 
-function _M.set_header(...)
+local function set_header(append, ...)

Review comment:
       Nice!




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

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