equal
deleted
inserted
replaced
40 body = stanza.name == "message" and stanza:get_child_text("body") or nil; |
40 body = stanza.name == "message" and stanza:get_child_text("body") or nil; |
41 stanza = tostring(stanza); |
41 stanza = tostring(stanza); |
42 }); |
42 }); |
43 http.request(url, { |
43 http.request(url, { |
44 body = request_body; |
44 body = request_body; |
45 }, function (response_text, code, _, response) |
45 }, function (response_text, code, response) |
46 if stanza.attr.type == "error" then return; end -- Avoid error loops, don't reply to error stanzas |
46 if stanza.attr.type == "error" then return; end -- Avoid error loops, don't reply to error stanzas |
47 if code == 200 and response_text and response.headers["content-type"] == "application/json" then |
47 if code == 200 and response_text and response.headers["content-type"] == "application/json" then |
48 local response_data = json.decode(response_text); |
48 local response_data = json.decode(response_text); |
49 if response_data.stanza then |
49 if response_data.stanza then |
50 local reply_stanza = xml.parse(response_data.stanza); |
50 local reply_stanza = xml.parse(response_data.stanza); |