aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_http.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-04-27 19:02:36 +0100
committerMatthew Wild <mwild1@gmail.com>2012-04-27 19:02:36 +0100
commit27e152ee76cb2e262c6bfb73214ec9d4957e94bd (patch)
tree377008c8c578eab1c33fd5c493baf7d651af55af /plugins/mod_http.lua
parent17fa5ed559e5dff83778f4f00768f58929744f8c (diff)
downloadprosody-27e152ee76cb2e262c6bfb73214ec9d4957e94bd.tar.gz
prosody-27e152ee76cb2e262c6bfb73214ec9d4957e94bd.zip
mod_http: Allow a route value to be static data rather than a handler function
Diffstat (limited to 'plugins/mod_http.lua')
-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)