Skip to content

Commit

Permalink
Merge pull request #25 from particle-iot/fix/default_fields
Browse files Browse the repository at this point in the history
Do not ignore default-initialized message fields
  • Loading branch information
sergeuz authored Apr 29, 2020
2 parents 378a0ac + 7e709ad commit adecf92
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,11 @@ export class Device extends DeviceBase {
}
if (req.reply) {
if (rep.data) {
r = Object.assign({}, r, req.reply.decode(rep.data));
// Parse the response message
r = Object.assign(req.reply.decode(rep.data), r);
} else {
// Return a message with default-initialized properties
r = Object.assign({}, r, req.reply.create());
// Create a message with default-initialized properties
r = Object.assign(req.reply.create(), r);
}
}
return r;
Expand Down

0 comments on commit adecf92

Please sign in to comment.