From 50774aed8a19836527b6c4f101442e3b09f19996 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 20 Jul 2017 20:04:50 -0300 Subject: [PATCH] fix: accept UPPER_CASE commands in send_command --- README.md | 1 - changelog.md | 6 +++++- lib/extendedApi.js | 5 +++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a43ac49bebe..2f01ed8a42c 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/changelog.md b/changelog.md index 60ab4e58f1e..791b968c6c3 100644 --- a/changelog.md +++ b/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 diff --git a/lib/extendedApi.js b/lib/extendedApi.js index 0e9589775be..bac36914139 100644 --- a/lib/extendedApi.js +++ b/lib/extendedApi.js @@ -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));