Skip to content

Commit

Permalink
setting default status to OK
Browse files Browse the repository at this point in the history
  • Loading branch information
callmehiphop committed Jul 22, 2016
1 parent 4032b43 commit d70602e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
5 changes: 2 additions & 3 deletions lib/common/grpc-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,9 @@ GrpcService.prototype.requestStream = function(protoOpts, reqOpts) {
request: function() {
return service[protoOpts.method](reqOpts, grpcOpts)
.on('metadata', function() {
var status = this.received_status || { code: 0 };
var grcpStatus = GrpcService.decorateStatus_(status);
var grcpStatus = GrpcService.decorateStatus_({ code: 0 });

this.emit('response', grcpStatus || status);
this.emit('response', grcpStatus);
});
}
};
Expand Down
25 changes: 0 additions & 25 deletions test/common/grpc-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -1063,31 +1063,6 @@ describe('GrpcService', function() {
});

it('should emit the metadata event as a response event', function(done) {
var grpcError500 = { code: 2 };
var fakeStream = through.obj();

ProtoService.prototype.method = function() {
return fakeStream;
};

retryRequestOverride = function(reqOpts, options) {
return options.request();
};

fakeStream.received_status = grpcError500;

fakeStream
.on('error', done)
.on('response', function(resp) {
assert.deepEqual(resp, GrpcService.GRPC_ERROR_CODE_TO_HTTP[2]);
done();
});

grpcService.requestStream(PROTO_OPTS, REQ_OPTS);
fakeStream.emit('metadata');
});

it('should default to OK status when metadata fires', function(done) {
var fakeStream = through.obj();

ProtoService.prototype.method = function() {
Expand Down

0 comments on commit d70602e

Please sign in to comment.