mirror of https://github.com/grpc/grpc-node.git
This commit is contained in:
parent
3bad9ae8f5
commit
b85a63c7c9
|
@ -72,8 +72,8 @@ grpc.setDefaultRootsPem(fs.readFileSync(SSL_ROOTS_PATH, 'ascii'));
|
||||||
* @return {Object<string, *>} The resulting gRPC object.
|
* @return {Object<string, *>} The resulting gRPC object.
|
||||||
*/
|
*/
|
||||||
exports.loadObject = function loadObject(value, options) {
|
exports.loadObject = function loadObject(value, options) {
|
||||||
options = Object.assign(common.defaultGrpcOptions, options);
|
options = Object.assign({}, common.defaultGrpcOptions, options);
|
||||||
options = Object.assign({'protobufjsVersion': 'detect'}, options);
|
options = Object.assign({}, {'protobufjsVersion': 'detect'}, options);
|
||||||
var protobufjsVersion;
|
var protobufjsVersion;
|
||||||
if (options.protobufjsVersion === 'detect') {
|
if (options.protobufjsVersion === 'detect') {
|
||||||
if (protobuf_js_6_common.isProbablyProtobufJs6(value)) {
|
if (protobuf_js_6_common.isProbablyProtobufJs6(value)) {
|
||||||
|
@ -122,7 +122,7 @@ var loadObject = exports.loadObject;
|
||||||
* @return {Object<string, *>} The resulting gRPC object
|
* @return {Object<string, *>} The resulting gRPC object
|
||||||
*/
|
*/
|
||||||
exports.load = util.deprecate(function load(filename, format, options) {
|
exports.load = util.deprecate(function load(filename, format, options) {
|
||||||
options = Object.assign(common.defaultGrpcOptions, options);
|
options = Object.assign({}, common.defaultGrpcOptions, options);
|
||||||
options.protobufjsVersion = 5;
|
options.protobufjsVersion = 5;
|
||||||
if (!format) {
|
if (!format) {
|
||||||
format = 'proto';
|
format = 'proto';
|
||||||
|
|
|
@ -932,12 +932,12 @@ Server.prototype.addProtoService = util.deprecate(function(service,
|
||||||
var protobuf_js_5_common = require('./protobuf_js_5_common');
|
var protobuf_js_5_common = require('./protobuf_js_5_common');
|
||||||
var protobuf_js_6_common = require('./protobuf_js_6_common');
|
var protobuf_js_6_common = require('./protobuf_js_6_common');
|
||||||
if (protobuf_js_5_common.isProbablyProtobufJs5(service)) {
|
if (protobuf_js_5_common.isProbablyProtobufJs5(service)) {
|
||||||
options = Object.assign(common.defaultGrpcOptions, service.grpc_options);
|
options = Object.assign({}, common.defaultGrpcOptions, service.grpc_options);
|
||||||
this.addService(
|
this.addService(
|
||||||
protobuf_js_5_common.getProtobufServiceAttrs(service, options),
|
protobuf_js_5_common.getProtobufServiceAttrs(service, options),
|
||||||
implementation);
|
implementation);
|
||||||
} else if (protobuf_js_6_common.isProbablyProtobufJs6(service)) {
|
} else if (protobuf_js_6_common.isProbablyProtobufJs6(service)) {
|
||||||
options = Object.assign(common.defaultGrpcOptions, service.grpc_options);
|
options = Object.assign({}, common.defaultGrpcOptions, service.grpc_options);
|
||||||
this.addService(
|
this.addService(
|
||||||
protobuf_js_6_common.getProtobufServiceAttrs(service, options),
|
protobuf_js_6_common.getProtobufServiceAttrs(service, options),
|
||||||
implementation);
|
implementation);
|
||||||
|
|
|
@ -81,7 +81,7 @@ describe('Proto message long int serialize and deserialize', function() {
|
||||||
neg_value);
|
neg_value);
|
||||||
});
|
});
|
||||||
it('should deserialize as a number with the right option set', function() {
|
it('should deserialize as a number with the right option set', function() {
|
||||||
var num_options = Object.assign(default_options, {longsAsStrings: false});
|
var num_options = Object.assign({}, default_options, {longsAsStrings: false});
|
||||||
var longNumDeserialize = deserializeCls(messages_proto.LongValues,
|
var longNumDeserialize = deserializeCls(messages_proto.LongValues,
|
||||||
num_options);
|
num_options);
|
||||||
var serialized = longSerialize({int_64: pos_value});
|
var serialized = longSerialize({int_64: pos_value});
|
||||||
|
@ -95,7 +95,7 @@ describe('Proto message bytes serialize and deserialize', function() {
|
||||||
var sequenceSerialize = serializeCls(messages_proto.SequenceValues);
|
var sequenceSerialize = serializeCls(messages_proto.SequenceValues);
|
||||||
var sequenceDeserialize = deserializeCls(
|
var sequenceDeserialize = deserializeCls(
|
||||||
messages_proto.SequenceValues, default_options);
|
messages_proto.SequenceValues, default_options);
|
||||||
var b64_options = Object.assign(default_options, {binaryAsBase64: true});
|
var b64_options = Object.assign({}, default_options, {binaryAsBase64: true});
|
||||||
var sequenceBase64Deserialize = deserializeCls(
|
var sequenceBase64Deserialize = deserializeCls(
|
||||||
messages_proto.SequenceValues, b64_options);
|
messages_proto.SequenceValues, b64_options);
|
||||||
var buffer_val = new Buffer([0x69, 0xb7]);
|
var buffer_val = new Buffer([0x69, 0xb7]);
|
||||||
|
@ -169,7 +169,7 @@ describe('Proto message enum serialize and deserialize', function() {
|
||||||
var enumSerialize = serializeCls(messages_proto.EnumValues);
|
var enumSerialize = serializeCls(messages_proto.EnumValues);
|
||||||
var enumDeserialize = deserializeCls(
|
var enumDeserialize = deserializeCls(
|
||||||
messages_proto.EnumValues, default_options);
|
messages_proto.EnumValues, default_options);
|
||||||
var enumIntOptions = Object.assign(default_options, {enumsAsStrings: false});
|
var enumIntOptions = Object.assign({}, default_options, {enumsAsStrings: false});
|
||||||
var enumIntDeserialize = deserializeCls(
|
var enumIntDeserialize = deserializeCls(
|
||||||
messages_proto.EnumValues, enumIntOptions);
|
messages_proto.EnumValues, enumIntOptions);
|
||||||
it('Should accept both names and numbers', function() {
|
it('Should accept both names and numbers', function() {
|
||||||
|
|
Loading…
Reference in New Issue