fix(batch-requests): ignore "unix:" in the configuration (#7109)
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
diff --git a/apisix/cli/ops.lua b/apisix/cli/ops.lua
index 85d0d45..098f91f 100644
--- a/apisix/cli/ops.lua
+++ b/apisix/cli/ops.lua
@@ -279,8 +279,10 @@
if real_ip_from then
for _, ip in ipairs(real_ip_from) do
local _ip = cli_ip:new(ip)
- if _ip and _ip:is_loopback() or _ip:is_unspecified() then
- pass_real_client_ip = true
+ if _ip then
+ if _ip:is_loopback() or _ip:is_unspecified() then
+ pass_real_client_ip = true
+ end
end
end
end
diff --git a/t/cli/test_validate_config.sh b/t/cli/test_validate_config.sh
index 2d7ba15..164d530 100755
--- a/t/cli/test_validate_config.sh
+++ b/t/cli/test_validate_config.sh
@@ -195,7 +195,7 @@
- "unix:"
' > conf/config.yaml
-out=$(make init 2>&1 || true)
+out=$(make init 2>&1)
if echo "$out" | grep "missing loopback or unspecified in the nginx_config.http.real_ip_from for plugin batch-requests"; then
echo "failed: should check the realip configuration for batch-requests"
exit 1