Skip to content

Commit

Permalink
fix: revert parsing username via URI due to potential breaking change…
Browse files Browse the repository at this point in the history
…s (#1134)
  • Loading branch information
janus-dev87 committed May 16, 2020
1 parent 4412127 commit 3666e06
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 22 deletions.
3 changes: 0 additions & 3 deletions lib/utils/index.ts
Expand Up @@ -258,9 +258,6 @@ export function parseURL(url) {
const result: any = {};
if (parsed.auth) {
const parsedAuth = parsed.auth.split(":");
if (parsedAuth[0]) {
result.username = parsedAuth[0];
}
result.password = parsedAuth[1];
}
if (parsed.pathname) {
Expand Down
17 changes: 0 additions & 17 deletions test/functional/auth.ts
Expand Up @@ -170,23 +170,6 @@ describe("auth", function () {
redis = new Redis({ port: 17379, username, password });
});

it("should handle auth with Redis URL string with username and password (Redis >=6) (redis://foo:bar@baz.com/) correctly", function (done) {
let username = "user";
let password = "pass";
let redis;
new MockServer(17379, function (argv) {
if (
argv[0] === "auth" &&
argv[1] === username &&
argv[2] === password
) {
redis.disconnect();
done();
}
});
redis = new Redis(`redis://user:pass@localhost:17379/`);
});

it('should not emit "error" when the Redis >=6 server doesn\'t need auth', function (done) {
new MockServer(17379, function (argv) {
if (argv[0] === "auth" && argv[1] === "pass") {
Expand Down
2 changes: 0 additions & 2 deletions test/unit/utils.ts
Expand Up @@ -193,7 +193,6 @@ describe("utils", function () {
port: "6380",
db: "4",
password: "pass",
username: "user",
key: "value",
});
expect(utils.parseURL("redis://127.0.0.1/")).to.eql({
Expand All @@ -206,7 +205,6 @@ describe("utils", function () {
port: "6380",
db: "4",
password: "pass",
username: "user",
key: "value",
});
});
Expand Down

0 comments on commit 3666e06

Please sign in to comment.