Skip to content

Commit 5e283ce

Browse files
committed
fix(eslint): add parseInt to all request response checks because type coersion was removed.
1 parent b6a80dd commit 5e283ce

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

lib/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ Cli.printNewsUpdates = function printNewsUpdates(skipNewsCheck) {
671671

672672
var downloadUrl = 'http://code.ionicframework.com/content/cli-message.json';
673673
request({ url: downloadUrl, proxy: proxy }, function(err, res, html) {
674-
if (!err && res && res.statusCode === 200) {
674+
if (!err && res && parseInt(res.statusCode, 10) === 200) {
675675
try {
676676
var newsId = IonicConfig.get('newsId');
677677
var messagesJson = JSON.parse(html);

lib/ionic/lib.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ IonicTask.prototype.getVersionData = function(version) {
9393
q.reject();
9494
return;
9595
}
96-
if (res.statusCode === 404) {
96+
if (parseInt(res.statusCode, 10) === 404) {
9797
log.error('Invalid version: ' + version);
9898
q.reject();
9999
return;
100100
}
101-
if (res.statusCode >= 400) {
101+
if (parseInt(res.statusCode, 10) >= 400) {
102102
log.error('Unable to load version data');
103103
q.reject();
104104
return;
@@ -220,11 +220,11 @@ IonicTask.prototype.downloadZip = function(version) {
220220
log.error(err);
221221
return;
222222
}
223-
if (res.statusCode === 404 || res.statusCode === 406) {
223+
if (parseInt(res.statusCode, 10) === 404 || parseInt(res.statusCode, 10) === 406) {
224224
log.error('Invalid version: ' + version);
225225
return;
226226
}
227-
if (res.statusCode >= 400) {
227+
if (parseInt(res.statusCode, 10) >= 400) {
228228
log.error('Unable to download zip (' + res.statusCode + ')');
229229
return;
230230
}

lib/ionic/push.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ IonicTask.prototype.set_webhook_url = function(task, webhook_url) { // eslint-di
9797
return task.ionic.fail('Error setting Webhook URL: ' + err);
9898
}
9999

100-
if (response.statusCode === '200') {
100+
if (parseInt(response.statusCode, 10) === '200') {
101101
log.info('Webhook URL set to', webhook_url);
102102
} else {
103103
return task.ionic.fail('App not found');
@@ -141,7 +141,7 @@ IonicTask.prototype.set_google_api_key = function(task, google_api_key) { // esl
141141
return task.ionic.fail('Error setting Google API Key: ' + err);
142142
}
143143

144-
if (response.statusCode === '200') {
144+
if (parseInt(response.statusCode, 10) === '200') {
145145
log.info('Google API Key Saved'.green);
146146
} else {
147147
return task.ionic.fail('App not found');
@@ -232,7 +232,7 @@ IonicTask.prototype.send_push = function(task) { // eslint-disable-line camelcas
232232
};
233233

234234
request(options, function(err, response) {
235-
if (!err && response.statusCode === 202) {
235+
if (!err && parseInt(response.statusCode, 10) === 202) {
236236
log.info('Successfully queued push notification');
237237
} else {
238238
log.error('Error queueing push notification', err);

lib/ionic/templates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ IonicTask.prototype.fetchStarterTemplates = function() {
2323

2424
var proxy = process.env.PROXY || null;
2525
request({ url: downloadUrl, proxy: proxy }, function(err, res, html) {
26-
if (!err && res && res.statusCode === 200) {
26+
if (!err && res && parseInt(res.statusCode, 10) === 200) {
2727
var templatesJson = {};
2828
try {
2929
templatesJson = JSON.parse(html);

0 commit comments

Comments
 (0)