mirror of https://github.com/grpc/grpc-node.git
adjust implementation to always return default options
This commit is contained in:
parent
99e8a060f6
commit
27d608763b
|
@ -249,10 +249,13 @@ function createSerializer(cls: Protobuf.Type): Serialize<object> {
|
|||
};
|
||||
}
|
||||
|
||||
function mapMethodOptions(options: Partial<MethodOptions>[] | undefined): MethodOptions | undefined {
|
||||
return Array.isArray(options) ?
|
||||
options.reduce((obj: MethodOptions, item: Partial<MethodOptions>) => ({ ...obj, ...item }), {}) :
|
||||
undefined;
|
||||
function mapMethodOptions(options: Partial<MethodOptions>[] | undefined): MethodOptions {
|
||||
return (options || []).reduce((obj: MethodOptions, item: Partial<MethodOptions>) => ({ ...obj, ...item }),
|
||||
{
|
||||
deprecated: false,
|
||||
idempotency_level: IdempotencyLevel.IDEMPOTENCY_UNKNOWN,
|
||||
uninterpreted_option: []
|
||||
});
|
||||
}
|
||||
|
||||
function createMethodDefinition(
|
||||
|
|
|
@ -160,6 +160,10 @@ describe('Descriptor types', () => {
|
|||
},
|
||||
'(google.api.method_signature)': 'bar'
|
||||
})
|
||||
assert(service.HelloWithoutOptions.options === undefined)
|
||||
assert.deepStrictEqual(service.HelloWithoutOptions.options, {
|
||||
deprecated: false,
|
||||
idempotency_level: 'IDEMPOTENCY_UNKNOWN',
|
||||
uninterpreted_option: []
|
||||
})
|
||||
})
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue