Diff

mod_rest/mod_rest.lua @ 3796:d1ad10b76b00

mod_rest: Catch one (1) reply to a POST-ed stanza from an internal source This will primarily cover error replies, and only those generated by the same Prosody instance using the `origin.reply()` method.
author Kim Alvefur <zash@zash.se>
date Mon, 30 Dec 2019 05:14:49 +0100
parent 3795:f51308fcba83
child 3797:ed5d7586a61e
line wrap: on
line diff
--- a/mod_rest/mod_rest.lua	Mon Dec 30 04:07:25 2019 +0100
+++ b/mod_rest/mod_rest.lua	Mon Dec 30 05:14:49 2019 +0100
@@ -63,7 +63,13 @@
 				end
 			end);
 	elseif payload.name == "message" or payload.name == "presence" then
-		if module:send(payload) then
+		local origin = {};
+		function origin.send(stanza)
+			response:send(tostring(stanza));
+			return true;
+		end
+		response.headers.content_type = "application/xmpp+xml";
+		if module:send(payload, origin) then
 			return 202;
 		else
 			return 500;