1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00

fix: accept UPPER_CASE commands in send_command

This commit is contained in:
Ruben Bridgewater
2017-07-20 20:04:50 -03:00
parent 789471b30a
commit 50774aed8a
3 changed files with 8 additions and 4 deletions

View File

@@ -705,7 +705,6 @@ accessed via the redis SELECT command. Each DB could use its own connection.
All Redis commands have been added to the `client` object. However, if new commands are introduced before this library is updated,
you can use `send_command()` to send arbitrary commands to Redis.
The command_name has to be lower case.
All commands are sent as multi-bulk commands. `args` can either be an Array of arguments, or omitted / set to undefined.

View File

@@ -1,6 +1,10 @@
# Changelog
## v.2.7.2 - 14 Mar, 2017
## v.2.8.0 - 20 Jul, 2017
Features
- Accept UPPER_CASE commands in send_command
Bugfixes

View File

@@ -16,6 +16,7 @@ RedisClient.prototype.send_command = RedisClient.prototype.sendCommand = functio
if (typeof command !== 'string') {
throw new TypeError('Wrong input type "' + (command !== null && command !== undefined ? command.constructor.name : command) + '" for command name');
}
command = command.toLowerCase();
if (!Array.isArray(args)) {
if (args === undefined || args === null) {
args = [];
@@ -32,9 +33,9 @@ RedisClient.prototype.send_command = RedisClient.prototype.sendCommand = functio
// Using the raw multi command is only possible with this function
// If the command is not yet added to the client, the internal function should be called right away
// Otherwise we need to redirect the calls to make sure the interal functions don't get skipped
// Otherwise we need to redirect the calls to make sure the internal functions don't get skipped
// The internal functions could actually be used for any non hooked function
// but this might change from time to time and at the moment there's no good way to distinguishe them
// but this might change from time to time and at the moment there's no good way to distinguish them
// from each other, so let's just do it do it this way for the time being
if (command === 'multi' || typeof this[command] !== 'function') {
return this.internal_send_command(new Command(command, args, callback));