Compare commits

..

2 Commits

Author SHA1 Message Date
Alexander Corn
c392f2ac74 3.7.2 2015-09-02 17:28:27 -04:00
Alexander Corn
8e6f859269 Properly handle all instances of access being denied because not logged in 2015-09-02 17:28:13 -04:00
2 changed files with 9 additions and 4 deletions

View File

@@ -153,7 +153,7 @@ SteamCommunity.prototype.getWebApiKey = function(domain, callback) {
"uri": "https://steamcommunity.com/dev/apikey",
"followRedirect": false
}, function(err, response, body) {
if(self._checkHttpError(err, response, callback, true)) {
if(self._checkHttpError(err, response, callback)) {
return;
}
@@ -305,13 +305,18 @@ SteamCommunity.prototype._myProfile = function(endpoint, form, callback) {
});
};
SteamCommunity.prototype._checkHttpError = function(err, response, callback, redirectIsFailure) {
SteamCommunity.prototype._checkHttpError = function(err, response, callback) {
if(err) {
callback(err);
return true;
}
if(response.statusCode >= (redirectIsFailure ? 300 : 400)) {
if(response.statusCode >= 300 && response.statusCode <= 399 && response.headers.location.indexOf('/login') != -1) {
callback(new Error("Not Logged In"));
return true;
}
if(response.statusCode >= 400) {
var error = new Error("HTTP error " + response.statusCode);
error.code = response.statusCode;
callback(error);

View File

@@ -1,6 +1,6 @@
{
"name": "steamcommunity",
"version": "3.7.1",
"version": "3.7.2",
"description": "Provides an interface for logging into and interacting with the Steam Community website",
"keywords": ["steam", "steam community"],
"homepage": "https://github.com/DoctorMcKay/node-steamcommunity",