Changeset

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
parents 11048:160308b4b384
children 11050:51be24b16e8a
files net/http.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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);