Mercurial > prosody-modules
comparison mod_component_http/mod_component_http.lua @ 2995:032589c801d7
mod_component_http: Fix parameter order, see Prosody trunk e2919978673e for more info
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 04 Apr 2018 21:59:00 +0100 |
parents | 13acce68a89c |
children |
comparison
equal
deleted
inserted
replaced
2994:9842979f3034 | 2995:032589c801d7 |
---|---|
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); |