comparison mod_muc_http_defaults/mod_muc_http_defaults.lua @ 4449:c25eef56e9c9

mod_muc_http_defaults: Fix order of http callback arguments
author Kim Alvefur <zash@zash.se>
date Fri, 19 Feb 2021 20:36:11 +0100
parents 5879ca1f7853
children 5f27bda5de80
comparison
equal deleted inserted replaced
4448:5879ca1f7853 4449:c25eef56e9c9
114 local url = render(url_template, event); 114 local url = render(url_template, event);
115 module:log("debug", "Calling API at %q for room %s", url, event.room.jid); 115 module:log("debug", "Calling API at %q for room %s", url, event.room.jid);
116 local wait, done = async.waiter(); 116 local wait, done = async.waiter();
117 117
118 local ret, err; 118 local ret, err;
119 http.request(url, ex, function (code, body) 119 http.request(url, ex, function (body, code)
120 if math.floor(code / 100) == 2 then 120 if math.floor(code / 100) == 2 then
121 local parsed, parse_err = json.decode(body); 121 local parsed, parse_err = json.decode(body);
122 if not parsed then 122 if not parsed then
123 module:log("debug", "Got invalid JSON from %s: %s", url, parse_err); 123 module:log("debug", "Got invalid JSON from %s: %s", url, parse_err);
124 err = problems.format; 124 err = problems.format;