Only use encoding for write flags if it is numeric

This commit is contained in:
murgatroid99 2015-08-17 14:06:32 -07:00
parent ff25af0163
commit ccb6cbe501
2 changed files with 10 additions and 2 deletions

View File

@ -86,7 +86,11 @@ function _write(chunk, encoding, callback) {
/* jshint validthis: true */
var batch = {};
var message = this.serialize(chunk);
message.grpcWriteFlags = encoding;
if (_.isFinite(encoding)) {
/* Attach the encoding if it is a finite number. This is the closest we
* can get to checking that it is valid flags */
message.grpcWriteFlags = encoding;
}
batch[grpc.opType.SEND_MESSAGE] = message;
this.call.startBatch(batch, function(err, event) {
if (err) {

View File

@ -270,7 +270,11 @@ function _write(chunk, encoding, callback) {
this.call.metadataSent = true;
}
var message = this.serialize(chunk);
message.grpcWriteFlags = encoding;
if (_.isFinite(encoding)) {
/* Attach the encoding if it is a finite number. This is the closest we
* can get to checking that it is valid flags */
message.grpcWriteFlags = encoding;
}
batch[grpc.opType.SEND_MESSAGE] = message;
this.call.startBatch(batch, function(err, value) {
if (err) {