From 07300ae3068a12975e17c0a82dbb464254e330fe Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Thu, 7 Sep 2017 13:32:32 +0100 Subject: [PATCH] Properly return a bluebird promise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs #8980 - ☹️ apparently this is actually the only way --- core/server/utils/request.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/core/server/utils/request.js b/core/server/utils/request.js index e92ed40a0f7..ffa2a93fb72 100644 --- a/core/server/utils/request.js +++ b/core/server/utils/request.js @@ -13,12 +13,14 @@ module.exports = function request(url, options) { })); } - return got( - url, - options - ).then(function (response) { - return Promise.resolve(response); - }).catch(function (err) { - return Promise.reject(err); + return new Promise(function (resolve, reject) { + return got( + url, + options + ).then(function (response) { + return resolve(response); + }).catch(function (err) { + return reject(err); + }); }); };