From 2300081d43173ceb6624bedf1b3ca08bd658aa28 Mon Sep 17 00:00:00 2001 From: Alexander Corn Date: Tue, 8 Mar 2016 01:37:20 -0500 Subject: [PATCH] Only fire the callback for blocked requests if one was provided --- components/http.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/http.js b/components/http.js index 0fbe4ae..5810423 100644 --- a/components/http.js +++ b/components/http.js @@ -38,17 +38,18 @@ SteamCommunity.prototype.httpRequest = function(uri, options, callback, source) continued = true; if (err) { - callback(err); + if (callback) { + callback(err); + } + return; } self.request(options, function (err, response, body) { var hasCallback = !!callback; var httpError = options.checkHttpError !== false && self._checkHttpError(err, response, callback); - var communityError = !options.json && options.checkCommunityError !== false && self._checkCommunityError(body, httpError ? function () { - } : callback); // don't fire the callback if hasHttpError did it already - var tradeError = !options.json && options.checkTradeError !== false && self._checkTradeError(body, httpError || communityError ? function () { - } : callback); // don't fire the callback if either of the previous already did + var communityError = !options.json && options.checkCommunityError !== false && self._checkCommunityError(body, httpError ? function () {} : callback); // don't fire the callback if hasHttpError did it already + var tradeError = !options.json && options.checkTradeError !== false && self._checkTradeError(body, httpError || communityError ? function () {} : callback); // don't fire the callback if either of the previous already did self.emit('postHttpRequest', requestID, source, options, httpError || communityError || tradeError || null, response, body, { "hasCallback": hasCallback,