mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Reworks REST API to return i18n success/error messages
Implements #4300
This commit is contained in:
parent
398e25c022
commit
16db3cda67
34 changed files with 175 additions and 171 deletions
|
|
@ -19,19 +19,19 @@ local rest_utils = require("rest_utils")
|
|||
|
||||
sendHTTPHeader('application/json')
|
||||
|
||||
local rc = rest_utils.consts_ok
|
||||
local rc = rest_utils.consts.success.ok
|
||||
local res = {}
|
||||
|
||||
local host_info = url2hostinfo(_POST)
|
||||
local custom_name = _POST["custom_name"]
|
||||
|
||||
if not haveAdminPrivileges() then
|
||||
print(rest_utils.rc(rest_utils.consts_not_granted))
|
||||
print(rest_utils.rc(rest_utils.consts.err.not_granted))
|
||||
return
|
||||
end
|
||||
|
||||
if host_info == nil or isEmptyString(host_info["host"]) or custom_name == nil then
|
||||
print(rest_utils.rc(rest_utils.consts_invalid_args))
|
||||
print(rest_utils.rc(rest_utils.consts.err.invalid_args))
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue