# HG changeset patch # User Kim Alvefur # Date 1613865600 -3600 # Node ID d5d895313be206fbb72962d969e59f64c4bb09e9 # Parent a1f26d17d70f15bd1934e1f02216b0be3c2d605f 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; }) diff -r a1f26d17d70f -r d5d895313be2 plugins/mod_http.lua --- a/plugins/mod_http.lua Tue Feb 23 02:56:49 2021 +0100 +++ b/plugins/mod_http.lua Sun Feb 21 01:00:00 2021 +0100 @@ -160,7 +160,13 @@ 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+");