Skip to content

Commit

Permalink
fix: accept UPPER_CASE commands in send_command
Browse files Browse the repository at this point in the history
  • Loading branch information
BridgeAR committed Jul 21, 2017
1 parent 789471b commit 50774ae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -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.

Expand Down
6 changes: 5 additions & 1 deletion changelog.md
@@ -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

Expand Down
5 changes: 3 additions & 2 deletions lib/extendedApi.js
Expand Up @@ -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 = [];
Expand All @@ -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));
Expand Down

0 comments on commit 50774ae

Please sign in to comment.