net.http: http.request() promise now resolves with response (breaking change)
authorMatthew Wild <mwild1@gmail.com>
Tue, 25 Aug 2020 15:59:04 +0100
changeset 11053 f103f59ea2b5
parent 11052 160308b4b384
child 11054 51be24b16e8a
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.
net/http.lua
--- a/net/http.lua	Tue Aug 25 15:57:39 2020 +0100
+++ b/net/http.lua	Tue Aug 25 15:59:04 2020 +0100
@@ -293,7 +293,8 @@
 						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);