@pusher/push-notifications-server
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -9,4 +9,8 @@ # Changelog | ||
## [1.0.1] - 2018-10-15 | ||
### Fixed | ||
- Accessing property on undefined object on non-json response | ||
## [1.0.0] - 2018-07-31 | ||
### Added | ||
- Changelog for GA release |
{ | ||
"name": "@pusher/push-notifications-server", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "NodeJS Server SDK for Pusher Push Notifications", | ||
@@ -5,0 +5,0 @@ "main": "push-notifications.js", |
const https = require('https'); | ||
const SDK_VERSION = '1.0.0'; | ||
const SDK_VERSION = '1.0.1'; | ||
const INTERESTS_REGEX = new RegExp('^(_|\\-|=|@|,|\\.|;|[A-Z]|[a-z]|[0-9])*$'); | ||
@@ -127,3 +127,5 @@ const INTEREST_STRING_MAX_LENGTH = 164; | ||
); | ||
return; | ||
} | ||
if (wasSuccessful) { | ||
@@ -130,0 +132,0 @@ resolve(responseBody); |
22
tests.js
@@ -123,3 +123,3 @@ const expect = require('chai').expect; | ||
authorization: 'Bearer SECRET_KEY', | ||
'x-pusher-library': 'pusher-push-notifications-node 1.0.0', | ||
'x-pusher-library': 'pusher-push-notifications-node 1.0.1', | ||
host: 'instance_id.pushnotifications.pusher.com' | ||
@@ -251,3 +251,3 @@ }); | ||
it('should reject the returned promise if response is not JSON', () => { | ||
it('should reject the returned promise if response is not JSON (success)', () => { | ||
nock(new RegExp('/.*/')) | ||
@@ -264,5 +264,21 @@ .post(new RegExp('/.*/')) | ||
expect(e).to.exist; | ||
expect(e.message).to.contain('Unknown error'); | ||
expect(e.message).to.contain('invalid server response'); | ||
}); | ||
}); | ||
it('should reject the returned promise if response is not JSON (failure)', () => { | ||
nock(new RegExp('/.*/')) | ||
.post(new RegExp('/.*/')) | ||
.reply(500, 'thisisnotjson{{{{{'); | ||
return pn | ||
.publish(['donuts'], {}) | ||
.then(() => { | ||
throw new Error('This should not succeed'); | ||
}) | ||
.catch(e => { | ||
expect(e).to.exist; | ||
expect(e.message).to.contain('invalid server response'); | ||
}); | ||
}); | ||
}); | ||
@@ -269,0 +285,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51908
440