aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-08-25 15:59:04 +0100
committerMatthew Wild <mwild1@gmail.com>2020-08-25 15:59:04 +0100
commitf8c7c8fd53c24a8b9e6e487c12ce4da8673cb1a0 (patch)
tree49f23ff057d74b1fd3a0fb2f9b26bbae7fc8d082
parent80616c004c1952471126f68e57ee61a0e740055b (diff)
downloadprosody-f8c7c8fd53c24a8b9e6e487c12ce4da8673cb1a0.tar.gz
prosody-f8c7c8fd53c24a8b9e6e487c12ce4da8673cb1a0.zip
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.
-rw-r--r--net/http.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/http.lua b/net/http.lua
index 2deeae14..c417ebec 100644
--- a/net/http.lua
+++ b/net/http.lua
@@ -293,7 +293,8 @@ local function new(options)
if code == 0 then
reject(http_errors.new(body, { request = a }));
else
- resolve({ request = b, response = a });
+ a.request = b;
+ resolve(a);
end
end);
end);