equal
deleted
inserted
replaced
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; |