Software /
code /
prosody
Comparison
net/http.lua @ 11049:f103f59ea2b5
net.http: http.request() promise now resolves with response (breaking change)
Promise mode is not (widely?) used, changing this now while we can, as it
improves usability of the API.
The request is now available as response.request, if needed.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 25 Aug 2020 15:59:04 +0100 |
parent | 11048:160308b4b384 |
child | 11068:988ddd57e851 |
comparison
equal
deleted
inserted
replaced
11048:160308b4b384 | 11049:f103f59ea2b5 |
---|---|
291 return promise.new(function (resolve, reject) | 291 return promise.new(function (resolve, reject) |
292 request(self, u, ex, function (body, code, a, b) | 292 request(self, u, ex, function (body, code, a, b) |
293 if code == 0 then | 293 if code == 0 then |
294 reject(http_errors.new(body, { request = a })); | 294 reject(http_errors.new(body, { request = a })); |
295 else | 295 else |
296 resolve({ request = b, response = a }); | 296 a.request = b; |
297 resolve(a); | |
297 end | 298 end |
298 end); | 299 end); |
299 end); | 300 end); |
300 end | 301 end |
301 end; | 302 end; |