From 27e152ee76cb2e262c6bfb73214ec9d4957e94bd Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 27 Apr 2012 19:02:36 +0100 Subject: mod_http: Allow a route value to be static data rather than a handler function --- plugins/mod_http.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'plugins') 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) -- cgit v1.2.3