Mercurial > prosody-modules
comparison mod_pubsub_github/mod_pubsub_github.lua @ 3510:f09423c29f31
mod_pubsub_github: Log debug message before attempting to publish
This data is probably more useful in case of a traceback than after
completing successfully
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 31 Mar 2019 16:11:37 +0200 |
| parents | 94414cadfcaa |
| children | 9556e92b2ec4 |
comparison
equal
deleted
inserted
replaced
| 3509:94414cadfcaa | 3510:f09423c29f31 |
|---|---|
| 24 if not data then | 24 if not data then |
| 25 response.status_code = 400; | 25 response.status_code = 400; |
| 26 return "Invalid JSON. From you of all people..."; | 26 return "Invalid JSON. From you of all people..."; |
| 27 end | 27 end |
| 28 | 28 |
| 29 module:log("debug", "Handling POST: \n%s\n", tostring(request.body)); | |
| 30 | |
| 29 for _, commit in ipairs(data.commits) do | 31 for _, commit in ipairs(data.commits) do |
| 30 local ok, err = pubsub_service:publish(node, true, data.repository.name, | 32 local ok, err = pubsub_service:publish(node, true, data.repository.name, |
| 31 st.stanza("item", { id = data.repository.name, xmlns = "http://jabber.org/protocol/pubsub" }) | 33 st.stanza("item", { id = data.repository.name, xmlns = "http://jabber.org/protocol/pubsub" }) |
| 32 :tag("entry", { xmlns = "http://www.w3.org/2005/Atom" }) | 34 :tag("entry", { xmlns = "http://www.w3.org/2005/Atom" }) |
| 33 :tag("id"):text(commit.id):up() | 35 :tag("id"):text(commit.id):up() |
| 42 if not ok then | 44 if not ok then |
| 43 return error_mapping[err] or 500; | 45 return error_mapping[err] or 500; |
| 44 end | 46 end |
| 45 end | 47 end |
| 46 | 48 |
| 47 module:log("debug", "Handled POST: \n%s\n", tostring(request.body)); | |
| 48 response.status_code = 202; | 49 response.status_code = 202; |
| 49 return "Thank you Github!"; | 50 return "Thank you Github!"; |
| 50 end | 51 end |
| 51 | 52 |
| 52 module:provides("http", { | 53 module:provides("http", { |
