From bdde6ae161db2b717574547c20f7095363ff5320 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Fri, 20 May 2022 14:09:55 +0200 Subject: [PATCH] fix(api) metadata represent infinity and non-numbers (#8833) --- kong/api/routes/kong.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kong/api/routes/kong.lua b/kong/api/routes/kong.lua index 966c376329b2..11a5dce5ac51 100644 --- a/kong/api/routes/kong.lua +++ b/kong/api/routes/kong.lua @@ -93,9 +93,15 @@ return { local available_plugins = {} for name in pairs(singletons.configuration.loaded_plugins) do + local pr = kong.db.plugins.handlers[name].PRIORITY + if pr ~= nil then + if type(pr) ~= "number" or math.abs(pr) == math.huge then + pr = tostring(pr) + end + end available_plugins[name] = { version = kong.db.plugins.handlers[name].VERSION, - priority = kong.db.plugins.handlers[name].PRIORITY, + priority = pr, } end