aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/mod_http.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua
index 4c6c1299..ef3f0271 100644
--- a/plugins/mod_http.lua
+++ b/plugins/mod_http.lua
@@ -51,7 +51,10 @@ function module.add_host(module)
for key, handler in pairs(event.item.route or {}) do
local event_name = get_http_event(host, app_path, key);
if event_name then
- if event_name:sub(-2, -1) == "/*" then
+ if type(handler) ~= "function" then
+ local data = handler;
+ handler = function () return data; end
+ elseif event_name:sub(-2, -1) == "/*" then
local base_path = event_name:match("/(.+)/*$");
local _handler = handler;
handler = function (event)