# HG changeset patch # User Matthew Wild # Date 1335549756 -3600 # Node ID a8c23433225830758164ccd70e5d75dc7702aa6a # Parent 198b11ed196ad56ad3b08207f304856d2548051a mod_http: Allow a route value to be static data rather than a handler function diff -r 198b11ed196a -r a8c234332258 plugins/mod_http.lua --- 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)