comparison mod_rest/mod_rest.lua @ 3806:c0caee8f54bb

mod_rest: Ensure identical id attribute for error replies
author Kim Alvefur <zash@zash.se>
date Wed, 01 Jan 2020 10:59:04 +0100
parents 683b06c0348f
children b0449faca52b
comparison
equal deleted inserted replaced
3805:683b06c0348f 3806:c0caee8f54bb
174 module:log("warn", "REST callback responded with invalid XML: %s, %q", err, body); 174 module:log("warn", "REST callback responded with invalid XML: %s, %q", err, body);
175 elseif parsed.name ~= stanza.name then 175 elseif parsed.name ~= stanza.name then
176 module:log("warn", "REST callback responded with the wrong stanza type, got %s but expected %s", parsed.name, stanza.name); 176 module:log("warn", "REST callback responded with the wrong stanza type, got %s but expected %s", parsed.name, stanza.name);
177 else 177 else
178 parsed.attr.to, parsed.attr.from = stanza.attr.from, stanza.attr.to; 178 parsed.attr.to, parsed.attr.from = stanza.attr.from, stanza.attr.to;
179 if parsed.name == "iq" then 179 if parsed.name == "iq" or parsed.attr.type == "error" then
180 parsed.attr.id = stanza.attr.id; 180 parsed.attr.id = stanza.attr.id;
181 end 181 end
182 reply = parsed; 182 reply = parsed;
183 end 183 end
184 elseif response.headers["content-type"] == "text/plain" then 184 elseif response.headers["content-type"] == "text/plain" then