diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-04-27 19:02:36 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-04-27 19:02:36 +0100 |
commit | af906903993b13bbdd304015ef8fb07355c0b984 (patch) | |
tree | 377008c8c578eab1c33fd5c493baf7d651af55af /plugins | |
parent | 0629f9223478422fb0d01e12bcb15e54362d5fae (diff) | |
download | prosody-af906903993b13bbdd304015ef8fb07355c0b984.tar.gz prosody-af906903993b13bbdd304015ef8fb07355c0b984.zip |
mod_http: Allow a route value to be static data rather than a handler function
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_http.lua | 5 |
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) |