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
commitc340e3ab373d32fd909e5902538031ed30d9585f (patch)
tree49f23ff057d74b1fd3a0fb2f9b26bbae7fc8d082
parent209660f21244ee06b5bfcd8f5addc830058d3104 (diff)
downloadprosody-c340e3ab373d32fd909e5902538031ed30d9585f.tar.gz
prosody-c340e3ab373d32fd909e5902538031ed30d9585f.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);