diff --git a/common/models/notification.js b/common/models/notification.js index d335160..05113ef 100644 --- a/common/models/notification.js +++ b/common/models/notification.js @@ -608,10 +608,10 @@ module.exports = function (Notification) { .get(uri) .then(function (response) { const body = response.data - if (response.statusCode === 200) { + if (response.status === 200) { return cb && cb(null, body) } - throw new Error(statusCode) + throw new Error(response.status) }) .catch(function (error) { Notification.app.models.Subscription.find( diff --git a/server/cron-tasks.js b/server/cron-tasks.js index 0954bd6..797fd96 100644 --- a/server/cron-tasks.js +++ b/server/cron-tasks.js @@ -281,7 +281,7 @@ module.exports.checkRssConfigUpdates = function() { responseType: 'stream' }) .then(function(res) { - if (res.statusCode !== 200) { + if (res.status !== 200) { reject(new Error('Bad status code')) } else { res.data.pipe(feedparser) diff --git a/spec/app/cron.spec.js b/spec/app/cron.spec.js index e910683..a788755 100644 --- a/spec/app/cron.spec.js +++ b/spec/app/cron.spec.js @@ -317,7 +317,7 @@ describe('CRON checkRssConfigUpdates', function() { spyOn(cronTasks, 'request').and.callFake(async function() { var output = fs.createReadStream(__dirname + path.sep + 'rss.xml') return { - statusCode: 200, + status: 200, data: output } }) @@ -457,7 +457,7 @@ describe('CRON checkRssConfigUpdates', function() { it('should handle error', async function() { cronTasks.request = jasmine.createSpy().and.callFake(async function() { return { - statusCode: 300 + status: 300 } }) try {