mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-02-06 10:49:15 +08:00
Only fire the callback for blocked requests if one was provided
This commit is contained in:
parent
0f20f918be
commit
2300081d43
@ -38,17 +38,18 @@ SteamCommunity.prototype.httpRequest = function(uri, options, callback, source)
|
||||
continued = true;
|
||||
|
||||
if (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,
|
||||
|
Loading…
Reference in New Issue
Block a user