Software /
code /
prosody
Changeset
4724:a8c234332258
mod_http: Allow a route value to be static data rather than a handler function
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 27 Apr 2012 19:02:36 +0100 |
parents | 4723:198b11ed196a |
children | 4725:d085db6285db |
files | plugins/mod_http.lua |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_http.lua Fri Apr 27 18:54:51 2012 +0100 +++ b/plugins/mod_http.lua Fri Apr 27 19:02:36 2012 +0100 @@ -51,7 +51,10 @@ 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)