addressing mingmin's comments

This commit is contained in:
Hongliang Xu 2017-03-07 12:01:07 -08:00
parent 75a5a3371b
commit c54792eee8

View File

@ -36,7 +36,7 @@ ProducerRecord.prototype.validate = function validate() {
if (typeof self.value !== 'string' && !Buffer.isBuffer(self.value)) {
return new Error('ProducerRecord value is neither string nor byte array');
}
if (self.key !== undefined && typeof self.value !== 'string') {
if (self.key !== undefined && typeof self.key !== 'string' && !Buffer.isBuffer(self.key)) {
return new Error('ProducerRecord value is neither string');
}
return null;