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 2022/08/26 09:42:06 UTC

[GitHub] [apisix] tokers commented on a diff in pull request #7794: feat(response-rewrite): support adding header

tokers commented on code in PR #7794:
URL: https://github.com/apache/apisix/pull/7794#discussion_r955862458


##########
apisix/plugins/response-rewrite.lua:
##########
@@ -27,13 +28,63 @@ local type        = type
 local pcall       = pcall
 
 
+local lrucache = core.lrucache.new({
+    type = "plugin",
+})
+
 local schema = {
     type = "object",
     properties = {
         headers = {
             description = "new headers for response",
-            type = "object",
-            minProperties = 1,
+            anyOf = {
+                {
+                    type = "object",
+                    minProperties = 1,
+                    patternProperties = {
+                        ["^[^:]+$"] = {
+                            oneOf = {
+                                {type = "string"},
+                                {type = "number"},
+                            }
+                        }
+                    },
+                },
+                {
+                    properties = {
+                        add = {
+                            type = "array",
+                            minItems = 1,
+                            items = {
+                                type = "string",
+                                -- "Set-Cookie: <cookie-name>=<cookie-value>; Max-Age=<number>"
+                                pattern = "^[^:]+:[^:]+[^/]$"
+                            }
+                        },
+                        set = {

Review Comment:
   `add` and `remove` are arrays but why `set` is an object?



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