Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: revert parsing username via URI due to potential breaking changes #1134

Merged
merged 1 commit into from May 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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