You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
Merge remote branch 'tj/bugs/empty-keys'
This commit is contained in:
3
index.js
3
index.js
@@ -118,6 +118,9 @@ RedisReplyParser.prototype.execute = function (incoming_buf) {
|
|||||||
this.multi_bulk_length = parseInt(small_toString(this.tmp_buffer), 10);
|
this.multi_bulk_length = parseInt(small_toString(this.tmp_buffer), 10);
|
||||||
this.multi_bulk_replies = [];
|
this.multi_bulk_replies = [];
|
||||||
this.state = "type";
|
this.state = "type";
|
||||||
|
if (0 == this.multi_bulk_length) {
|
||||||
|
this.send_reply([]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.emit("error", new Error("didn't see LF after NL reading multi bulk count"));
|
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
|
this.state = "type"; // try to start over with next data chunk
|
||||||
|
9
test.js
9
test.js
@@ -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 () {
|
tests.RANDOMKEY = function () {
|
||||||
var name = "RANDOMKEY";
|
var name = "RANDOMKEY";
|
||||||
client.mset(["test keys 1", "test val 1", "test keys 2", "test val 2"], require_string("OK", name));
|
client.mset(["test keys 1", "test val 1", "test keys 2", "test val 2"], require_string("OK", name));
|
||||||
|
Reference in New Issue
Block a user