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 individual createClient functions passing undefined options to a new instance. Closes #893
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
## v.2.2.5 - 18 Oct, 2015
|
||||
|
||||
Bugfixes
|
||||
|
||||
- Fixed undefined options passed to a new instance not accepted (possible with individual .createClient functions) ([@BridgeAR](https://github.com/BridgeAR))
|
||||
|
||||
## v.2.2.4 - 17 Oct, 2015
|
||||
|
||||
Bugfixes
|
||||
|
2
index.js
2
index.js
@@ -36,7 +36,7 @@ parsers.push(require('./lib/parsers/javascript'));
|
||||
|
||||
function RedisClient(stream, options) {
|
||||
// Copy the options so they are not mutated
|
||||
options = JSON.parse(JSON.stringify(options));
|
||||
options = JSON.parse(JSON.stringify(options || {}));
|
||||
var self = this;
|
||||
|
||||
if (!stream.cork) {
|
||||
|
@@ -4,6 +4,7 @@ var assert = require("assert");
|
||||
var config = require("./lib/config");
|
||||
var helper = require('./helper');
|
||||
var redis = config.redis;
|
||||
var net = require('net');
|
||||
|
||||
describe("connection tests", function () {
|
||||
helper.allTests(function(parser, ip, args) {
|
||||
@@ -186,27 +187,16 @@ describe("connection tests", function () {
|
||||
});
|
||||
});
|
||||
|
||||
it("buffer commands and flush them after ", function (done) {
|
||||
client = redis.createClient(9999, null, {
|
||||
parser: parser
|
||||
});
|
||||
|
||||
client.on('error', function(e) {
|
||||
// ignore, b/c expecting a "can't connect" error
|
||||
});
|
||||
|
||||
return setTimeout(function() {
|
||||
client.set('foo', 'bar', function(err, result) {
|
||||
// This should never be called
|
||||
return done(err);
|
||||
});
|
||||
|
||||
return setTimeout(function() {
|
||||
assert.strictEqual(client.offline_queue.length, 1);
|
||||
return done();
|
||||
}, 25);
|
||||
}, 50);
|
||||
});
|
||||
it("works with missing options object for new redis instances", function () {
|
||||
// This is needed for libraries that have their own createClient function like fakeredis
|
||||
var cnxOptions = {
|
||||
port : 6379,
|
||||
host : '127.0.0.1',
|
||||
family : ip === 'IPv6' ? 6 : 4
|
||||
};
|
||||
var net_client = net.createConnection(cnxOptions);
|
||||
client = new redis.RedisClient(net_client);
|
||||
});
|
||||
|
||||
it("throws on strange connection info", function () {
|
||||
try {
|
||||
|
Reference in New Issue
Block a user