mod_rest: Guess 'get' as default type for 'iq' stanzas in JSON mapping
authorKim Alvefur <zash@zash.se>
Wed, 01 Jan 2020 17:37:04 +0100
changeset 3822 a607c69d0804
parent 3821 937f8c463be6
child 3823 1bab6f67eb5f
mod_rest: Guess 'get' as default type for 'iq' stanzas in JSON mapping
mod_rest/jsonmap.lib.lua
--- a/mod_rest/jsonmap.lib.lua	Wed Jan 01 17:16:40 2020 +0100
+++ b/mod_rest/jsonmap.lib.lua	Wed Jan 01 17:37:04 2020 +0100
@@ -225,6 +225,9 @@
 	if t.from and not s.attr.from then
 		return nil, "invalid-jid-from";
 	end
+	if kind == "iq" and not t.type then
+		t.type = "get";
+	end
 
 	if type(t.error) == "table" then
 		return st.error_reply(st.reply(s), str(t.error.type), str(t.error.condition), str(t.error.text));