Add warning when ret_code is not supported
This commit is contained in:
parent
5c6e890f49
commit
29b27f4218
1 changed files with 6 additions and 0 deletions
|
@ -11,15 +11,21 @@ M.ret_code = ngx.HTTP_FORBIDDEN
|
||||||
function M.new(template_path, redirect_location, ret_code)
|
function M.new(template_path, redirect_location, ret_code)
|
||||||
M.redirect_location = redirect_location
|
M.redirect_location = redirect_location
|
||||||
|
|
||||||
|
ret_code_ok = false
|
||||||
if ret_code ~= nil and ret_code ~= 0 then
|
if ret_code ~= nil and ret_code ~= 0 then
|
||||||
for k, v in pairs(utils.HTTP_CODE) do
|
for k, v in pairs(utils.HTTP_CODE) do
|
||||||
if k == ret_code then
|
if k == ret_code then
|
||||||
M.ret_code = utils.HTTP_CODE[ret_code]
|
M.ret_code = utils.HTTP_CODE[ret_code]
|
||||||
|
ret_code_ok = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if ret_code_ok == false then
|
||||||
|
ngx.log(ngx.ERR, "RET_CODE '" .. ret_code .. "' is not supported")
|
||||||
|
end
|
||||||
|
|
||||||
template_file_ok = false
|
template_file_ok = false
|
||||||
if (template_path ~= nil and template_path ~= "" and utils.file_exist(template_path) == true) then
|
if (template_path ~= nil and template_path ~= "" and utils.file_exist(template_path) == true) then
|
||||||
M.template_str = utils.read_file(template_path)
|
M.template_str = utils.read_file(template_path)
|
||||||
|
|
Loading…
Add table
Reference in a new issue