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



##########
File path: apisix/plugins/fault-injection.lua
##########
@@ -64,6 +119,25 @@ local function sample_hit(percentage)
 end
 
 
+local function vars_match(vars, ctx)
+    local match_result
+    for _, var in ipairs(vars) do
+        local expr, err = expr.new(var)
+        if err then
+            core.log.error("vars expression does not match: ", err)
+            return nil, err
+        end
+
+        match_result = expr:eval(ctx.var)
+        if match_result then
+            break
+        end
+    end
+
+    return match_result, nil
+end
+
+
 function _M.check_schema(conf)
     local ok, err = core.schema.check(schema, conf)

Review comment:
       Better to check the expression here and add a test for it.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to