Mercurial > prosody-modules
diff mod_http_upload/mod_http_upload.lua @ 1942:ff95d983940c
mod_http_upload: Say Hello to anyone opening the "bare" HTTP URL (helpful to show that module is loaded correctly)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 01 Nov 2015 18:12:49 +0100 |
parents | b01d60dfa405 |
children | 3b748666ff97 |
line wrap: on
line diff
--- a/mod_http_upload/mod_http_upload.lua Fri Oct 30 17:47:48 2015 +0100 +++ b/mod_http_upload/mod_http_upload.lua Sun Nov 01 18:12:49 2015 +0100 @@ -161,8 +161,15 @@ return serve_uploaded_files(event, path); end +local function serve_hello(event) + event.response.headers.content_type = "text/html;charset=utf-8" + return "<!DOCTYPE html>\n<h1>Hello from mod_"..module.name.."!</h1>\n"; +end + module:provides("http", { route = { + ["GET"] = serve_hello; + ["GET /"] = serve_hello; ["GET /*"] = serve_uploaded_files; ["HEAD /*"] = serve_head; ["PUT /*"] = upload_data;