From 232eba2f7d7dfc47670a3a9b6745a8782180c1d7 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Mon, 15 Apr 2019 21:07:23 +0100 Subject: [PATCH] Http utilities: add xhr object to callback --- core/modules/utils/dom/http.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/modules/utils/dom/http.js b/core/modules/utils/dom/http.js index 7fdd81781..77cb67c24 100644 --- a/core/modules/utils/dom/http.js +++ b/core/modules/utils/dom/http.js @@ -17,7 +17,7 @@ A quick and dirty HTTP function; to be refactored later. Options are: url: URL to retrieve headers: hashmap of headers to send type: GET, PUT, POST etc - callback: function invoked with (err,data) + callback: function invoked with (err,data,xhr) returnProp: string name of the property to return as first argument of callback */ exports.httpRequest = function(options) { @@ -48,7 +48,7 @@ exports.httpRequest = function(options) { return; } // Something went wrong - options.callback($tw.language.getString("Error/XMLHttpRequest") + ": " + this.status); + options.callback($tw.language.getString("Error/XMLHttpRequest") + ": " + this.status,null,this); } }; // Make the request @@ -67,7 +67,7 @@ exports.httpRequest = function(options) { try { request.send(data); } catch(e) { - options.callback(e); + options.callback(e,null,this); } return request; };