You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Fix issue with buffers in objects using hSet (#2139)
* Fix issue with buffers in objects using hSet When using hSet with an object, any buffer values inside the object are converted to strings instead of left as buffers. This fix specifically handles the special case of buffers, whilst casting everything else strings (to continue "gracefully" handling the case where the value not a valid type). * Update HSET.ts * Update HSET.spec.ts Co-authored-by: Leibale Eidelman <leibale1998@gmail.com>
This commit is contained in:
@@ -41,11 +41,20 @@ describe('HSET', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('Object', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key', { field: 'value' }),
|
||||
['HSET', 'key', 'field', 'value']
|
||||
);
|
||||
describe('Object', () => {
|
||||
it('string', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key', { field: 'value' }),
|
||||
['HSET', 'key', 'field', 'value']
|
||||
);
|
||||
});
|
||||
|
||||
it('Buffer', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key', { field: Buffer.from('value') }),
|
||||
['HSET', 'key', 'field', Buffer.from('value')]
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -62,4 +71,4 @@ describe('HSET', () => {
|
||||
1
|
||||
);
|
||||
}, GLOBAL.CLUSTERS.OPEN);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user