Skip to content

Commit d70602e

Browse files
committed
setting default status to OK
1 parent 4032b43 commit d70602e

2 files changed

Lines changed: 2 additions & 28 deletions

File tree

lib/common/grpc-service.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,9 @@ GrpcService.prototype.requestStream = function(protoOpts, reqOpts) {
326326
request: function() {
327327
return service[protoOpts.method](reqOpts, grpcOpts)
328328
.on('metadata', function() {
329-
var status = this.received_status || { code: 0 };
330-
var grcpStatus = GrpcService.decorateStatus_(status);
329+
var grcpStatus = GrpcService.decorateStatus_({ code: 0 });
331330

332-
this.emit('response', grcpStatus || status);
331+
this.emit('response', grcpStatus);
333332
});
334333
}
335334
};

test/common/grpc-service.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,31 +1063,6 @@ describe('GrpcService', function() {
10631063
});
10641064

10651065
it('should emit the metadata event as a response event', function(done) {
1066-
var grpcError500 = { code: 2 };
1067-
var fakeStream = through.obj();
1068-
1069-
ProtoService.prototype.method = function() {
1070-
return fakeStream;
1071-
};
1072-
1073-
retryRequestOverride = function(reqOpts, options) {
1074-
return options.request();
1075-
};
1076-
1077-
fakeStream.received_status = grpcError500;
1078-
1079-
fakeStream
1080-
.on('error', done)
1081-
.on('response', function(resp) {
1082-
assert.deepEqual(resp, GrpcService.GRPC_ERROR_CODE_TO_HTTP[2]);
1083-
done();
1084-
});
1085-
1086-
grpcService.requestStream(PROTO_OPTS, REQ_OPTS);
1087-
fakeStream.emit('metadata');
1088-
});
1089-
1090-
it('should default to OK status when metadata fires', function(done) {
10911066
var fakeStream = through.obj();
10921067

10931068
ProtoService.prototype.method = function() {

0 commit comments

Comments
 (0)