Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
fix(devices): serialize push payload in /devices/notify route
Browse files Browse the repository at this point in the history
Fixes #1386
  • Loading branch information
eoger committed Aug 2, 2016
1 parent b6f2ba8 commit b91a982
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/routes/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ module.exports = function (
throw error.invalidRequestParameter('invalid payload')
}
var pushOptions = {
data: payload
data: new Buffer(JSON.stringify(payload))
}
if (body.excluded) {
pushOptions.excludedDeviceIds = body.excluded
Expand Down
4 changes: 2 additions & 2 deletions test/local/account_routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ test('/account/devices/notify', function (t) {
t.equal(args[0], uid.toString('hex'), 'first argument was the device uid')
t.equal(args[1], 'devicesNotify', 'second argument was the devicesNotify reason')
t.deepEqual(args[2], {
data: pushPayload,
data: new Buffer(JSON.stringify(pushPayload)),
excludedDeviceIds: ['bogusid'],
TTL: 60
}, 'third argument was the push options')
Expand All @@ -478,7 +478,7 @@ test('/account/devices/notify', function (t) {
t.deepEqual(args[1], ['bogusid1', 'bogusid2'], 'second argument was the list of device ids')
t.equal(args[2], 'devicesNotify', 'third argument was the devicesNotify reason')
t.deepEqual(args[3], {
data: pushPayload,
data: new Buffer(JSON.stringify(pushPayload)),
TTL: 60
}, 'fourth argument was the push options')
})
Expand Down

0 comments on commit b91a982

Please sign in to comment.