Fixed handling of long values

This commit is contained in:
murgatroid99 2015-06-05 13:58:25 -07:00
parent 9c54277c6a
commit 35d83d25e1
2 changed files with 5 additions and 2 deletions

View File

@ -47,7 +47,9 @@ function deserializeCls(cls) {
* @return {cls} The resulting object
*/
return function deserialize(arg_buf) {
return cls.decode(arg_buf).toRaw();
// Convert to a native object with binary fields as Buffers (first argument)
// and longs as strings (second argument)
return cls.decode(arg_buf).toRaw(false, true);
};
}

View File

@ -39,7 +39,8 @@ var common = require('../src/common.js');
var ProtoBuf = require('protobufjs');
var messages_proto = ProtoBuf.loadProtoFile(__dirname + '/test_messages.proto').build();
var messages_proto = ProtoBuf.loadProtoFile(
__dirname + '/test_messages.proto').build();
describe('Proto message serialize and deserialize', function() {
var longSerialize = common.serializeCls(messages_proto.LongValues);