Compare commits

...

2 Commits

Author SHA1 Message Date
Alexander Corn
84dce9872a 3.7.1 2015-09-02 17:22:17 -04:00
Alexander Corn
c2ad457e87 Fixed getWebApiKey not failing if not logged in 2015-09-02 17:19:12 -04:00
2 changed files with 13 additions and 10 deletions

View File

@@ -149,8 +149,11 @@ function generateSessionID() {
SteamCommunity.prototype.getWebApiKey = function(domain, callback) {
var self = this;
this.request("https://steamcommunity.com/dev/apikey", function(err, response, body) {
if(self._checkHttpError(err, response, callback)) {
this.request({
"uri": "https://steamcommunity.com/dev/apikey",
"followRedirect": false
}, function(err, response, body) {
if(self._checkHttpError(err, response, callback, true)) {
return;
}
@@ -172,8 +175,8 @@ SteamCommunity.prototype.getWebApiKey = function(domain, callback) {
"Submit": "Register"
}
}, function(err, response, body) {
if(err || response.statusCode >= 400) {
return callback(err.message || "HTTP error " + response.statusCode);
if(self._checkHttpError(err, response, callback)) {
return;
}
self.getWebApiKey(domain, callback);
@@ -302,13 +305,13 @@ SteamCommunity.prototype._myProfile = function(endpoint, form, callback) {
});
};
SteamCommunity.prototype._checkHttpError = function(err, response, callback) {
SteamCommunity.prototype._checkHttpError = function(err, response, callback, redirectIsFailure) {
if(err) {
callback(err);
return true;
}
if(response.statusCode != 200) {
if(response.statusCode >= (redirectIsFailure ? 300 : 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.0",
"version": "3.7.1",
"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",
@@ -13,10 +13,10 @@
"url": "https://github.com/DoctorMcKay/node-steamcommunity.git"
},
"dependencies": {
"request": "^2.58.0",
"request": "^2.61.0",
"node-bignumber": "^1.2.1",
"steamid": "^0.3.0",
"xml2js": "^0.4.9",
"steamid": "^0.3.1",
"xml2js": "^0.4.11",
"cheerio": "^0.19.0"
}
}