Software /
code /
prosody-modules
Comparison
mod_rest/mod_rest.lua @ 3926:f77ae9685eb6
mod_rest: Fix routing to self-jid (thanks jonas’)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 29 Feb 2020 13:26:05 +0100 |
parent | 3925:7dec5d096bb8 |
child | 3929:bd687d586a8a |
comparison
equal
deleted
inserted
replaced
3925:7dec5d096bb8 | 3926:f77ae9685eb6 |
---|---|
159 }; | 159 }; |
160 module:log("debug", "Received[rest]: %s", payload:top_tag()); | 160 module:log("debug", "Received[rest]: %s", payload:top_tag()); |
161 local send_type = decide_type((request.headers.accept or "") ..",".. request.headers.content_type) | 161 local send_type = decide_type((request.headers.accept or "") ..",".. request.headers.content_type) |
162 if payload.name == "iq" then | 162 if payload.name == "iq" then |
163 function origin.send(stanza) | 163 function origin.send(stanza) |
164 prosody.core_route_stanza(nil, stanza); | 164 module:send(stanza); |
165 end | 165 end |
166 if payload.attr.type ~= "get" and payload.attr.type ~= "set" then | 166 if payload.attr.type ~= "get" and payload.attr.type ~= "set" then |
167 return errors.new({ code = 422, text = "'iq' stanza must be of type 'get' or 'set'" }); | 167 return errors.new({ code = 422, text = "'iq' stanza must be of type 'get' or 'set'" }); |
168 elseif #payload.tags ~= 1 then | 168 elseif #payload.tags ~= 1 then |
169 return errors.new({ code = 422, text = "'iq' stanza must have exactly one child tag" }); | 169 return errors.new({ code = 422, text = "'iq' stanza must have exactly one child tag" }); |