Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ RedisReplyParser.prototype.execute = function (incoming_buf) {
this.multi_bulk_length = parseInt(small_toString(this.tmp_buffer), 10);
this.multi_bulk_replies = [];
this.state = "type";
if (0 == this.multi_bulk_length) {
this.send_reply([]);
}
} else {
this.emit("error", new Error("didn't see LF after NL reading multi bulk count"));
this.state = "type"; // try to start over with next data chunk
Expand Down
9 changes: 9 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,15 @@ tests.KEYS = function () {
});
};

tests.MULTIBULK_ZERO_LENGTH = function () {
var name = "MULTIBULK_ZERO_LENGTH";
client.KEYS(['users:*'], function(err, results){
assert.strictEqual(null, err, 'error on empty multibulk reply');
assert.strictEqual(0, results.length);
next(name);
});
};

tests.RANDOMKEY = function () {
var name = "RANDOMKEY";
client.mset(["test keys 1", "test val 1", "test keys 2", "test val 2"], require_string("OK", name));
Expand Down