Fix return value when no plugins have been found in api.lua

This commit is contained in:
Théophile Diot 2023-06-09 13:29:14 -04:00
parent 6ab48d9dd2
commit ec48e66011
No known key found for this signature in database
GPG key ID: E752C80DB72BB014

View file

@ -224,7 +224,7 @@ function api:do_api_call()
local list, err = self.datastore:get("plugins")
if not list then
local status, resp = self:response(ngx.HTTP_INTERNAL_SERVER_ERROR, "error", "can't list loaded plugins : " .. err)
return false, resp["msg"], ngx.HTTP_INTERNAL_SERVER_ERROR, resp
return false, resp["msg"], ngx.HTTP_INTERNAL_SERVER_ERROR, cjson.encode(resp)
end
list = cjson.decode(list)
for i, plugin in ipairs(list) do