in apisix/plugins/response-rewrite.lua [204:247]
function _M.check_schema(conf)
local ok, err = core.schema.check(schema, conf)
if not ok then
return false, err
end
if conf.headers then
if not is_new_headers_conf(conf.headers) then
ok, err = check_set_headers(conf.headers)
if not ok then
return false, err
end
end
end
if conf.body_base64 then
if not conf.body or #conf.body == 0 then
return false, 'invalid base64 content'
end
local body = ngx.decode_base64(conf.body)
if not body then
return false, 'invalid base64 content'
end
end
if conf.vars then
local ok, err = expr.new(conf.vars)
if not ok then
return false, "failed to validate the 'vars' expression: " .. err
end
end
if conf.filters then
for _, filter in ipairs(conf.filters) do
local ok, err = pcall(re_compile, filter.regex, filter.options)
if not ok then
return false, "regex \"" .. filter.regex ..
"\" validation failed: " .. err
end
end
end
return true
end