diff options
-rw-r--r-- | src/node/src/client.js | 6 | ||||
-rw-r--r-- | src/node/src/server.js | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/node/src/client.js b/src/node/src/client.js index 3c3642adeb..48fe0dd3b7 100644 --- a/src/node/src/client.js +++ b/src/node/src/client.js @@ -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) { diff --git a/src/node/src/server.js b/src/node/src/server.js index 3b3bab8293..5037abae43 100644 --- a/src/node/src/server.js +++ b/src/node/src/server.js @@ -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) { |