Skip to content

Commit 01975f6

Browse files
committed
Merge branch 'master' of https://github.com/nick-apperson/node_redis into nick-apperson-master
2 parents ead286f + 6f00ff8 commit 01975f6

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ function reply_to_object(reply) {
590590
}
591591

592592
for (j = 0, jl = reply.length; j < jl; j += 2) {
593-
key = reply[j].toString();
593+
key = reply[j].toString('binary');
594594
val = reply[j + 1];
595595
obj[key] = val;
596596
}

test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,21 @@ tests.HGETALL = function () {
14041404
});
14051405
};
14061406

1407+
tests.HGETALL_2 = function () {
1408+
var name = "HGETALL (Binary client)";
1409+
bclient.hmset(["bhosts", "mjr", "1", "another", "23", "home", "1234", new Buffer([0xAA, 0xBB, 0x00, 0xF0]), new Buffer([0xCC, 0xDD, 0x00, 0xF0])], require_string("OK", name));
1410+
bclient.HGETALL(["bhosts"], function (err, obj) {
1411+
assert.strictEqual(null, err, name + " result sent back unexpected error: " + err);
1412+
assert.strictEqual(4, Object.keys(obj).length, name);
1413+
assert.strictEqual("1", obj.mjr.toString(), name);
1414+
assert.strictEqual("23", obj.another.toString(), name);
1415+
assert.strictEqual("1234", obj.home.toString(), name);
1416+
assert.strictEqual((new Buffer([0xAA, 0xBB, 0x00, 0xF0])).toString('binary'), Object.keys(obj)[3], name);
1417+
assert.strictEqual((new Buffer([0xCC, 0xDD, 0x00, 0xF0])).toString('binary'), obj[(new Buffer([0xAA, 0xBB, 0x00, 0xF0])).toString('binary')].toString('binary'), name);
1418+
next(name);
1419+
});
1420+
};
1421+
14071422
tests.HGETALL_MESSAGE = function () {
14081423
var name = "HGETALL_MESSAGE";
14091424
client.hmset("msg_test", {message: "hello"}, require_string("OK", name));

0 commit comments

Comments
 (0)