1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

fix for issue of saving document with buffer AND array on it

This commit is contained in:
Andy Ray
2011-01-28 15:34:24 -05:00
committed by Matt Ranney
parent 850d129629
commit bbd48a6fac
2 changed files with 12 additions and 1 deletions

View File

@@ -529,7 +529,7 @@ RedisClient.prototype.send_command = function () {
for (i = 0, il = args.length, arg; i < il; i += 1) { for (i = 0, il = args.length, arg; i < il; i += 1) {
arg = args[i]; arg = args[i];
if (arg.length === undefined) { if (!(arg instanceof Buffer || arg instanceof String)) {
arg = String(arg); arg = String(arg);
} }

11
test.js
View File

@@ -285,6 +285,17 @@ tests.HSET = function () {
client.HSET(key, field2, value2, last(name, require_number(0, name))); client.HSET(key, field2, value2, last(name, require_number(0, name)));
}; };
tests.HMSET_BUFFER_AND_ARRAY = function () {
// Saving a buffer and an array to the same document should not error
var key = "test hash",
field1 = "buffer",
value1 = new Buffer("abcdefghij"),
field2 = "array",
value2 = [],
name = "HSET";
client.HMSET(key, field1, value1, field2, value2, last(name, require_string("OK", name)));
};
tests.HMGET = function () { tests.HMGET = function () {
var key1 = "test hash 1", key2 = "test hash 2", name = "HMGET"; var key1 = "test hash 1", key2 = "test hash 2", name = "HMGET";