aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-02-21 01:00:00 +0100
committerKim Alvefur <zash@zash.se>2021-02-21 01:00:00 +0100
commit19eb9076130c575a32eb25175630357a1c375917 (patch)
tree22ea23972b485268eebf52f0248bb7de2739684b
parentb01915e81c38ddee6ddba791060d441476d5b81c (diff)
downloadprosody-19eb9076130c575a32eb25175630357a1c375917.tar.gz
prosody-19eb9076130c575a32eb25175630357a1c375917.zip
mod_http: Warn if app is missing 'route'
Makes no sense to have a http module with no handlers Would have helped me when I accidentally module:provides("http", { GET = handler; })
-rw-r--r--plugins/mod_http.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua
index a13b689b..43d65b38 100644
--- a/plugins/mod_http.lua
+++ b/plugins/mod_http.lua
@@ -160,7 +160,13 @@ function module.add_host(module)
local streaming = event.item.streaming_uploads;
- for key, handler in pairs(event.item.route or {}) do
+ if not event.item.route then
+ -- TODO: Link to docs
+ module:log("error", "HTTP app %q provides no 'route', a typo or mistake?", app_name);
+ return;
+ end
+
+ for key, handler in pairs(event.item.route) do
local event_name = get_http_event(host, app_path, key);
if event_name then
local method = event_name:match("^%S+");