From 18e0a419ac3a80c92e70f9d782f51db76a96db56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Lled=C3=B3?= Date: Tue, 19 Aug 2025 11:40:32 +0200 Subject: [PATCH 1/2] Endpoint#for: send credentials to constructor rather than URI --- lib/async/redis/endpoint.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/async/redis/endpoint.rb b/lib/async/redis/endpoint.rb index a76e334..369d2b6 100644 --- a/lib/async/redis/endpoint.rb +++ b/lib/async/redis/endpoint.rb @@ -63,7 +63,7 @@ def self.parse(string, endpoint = nil, **options) # @parameter scheme [String, nil] The scheme to use, e.g. "redis" or "rediss". If nil, will auto-detect. # @parameter hostname [String] The hostname to connect to (or bind to). # @parameter options [Hash] Additional options, passed to {#initialize}. - def self.for(scheme, host, credentials: nil, port: nil, database: nil, **options) + def self.for(scheme, host, port: nil, database: nil, **options) # Auto-detect scheme if not provided: if default_scheme = options.delete(:scheme) scheme ||= default_scheme @@ -82,7 +82,6 @@ def self.for(scheme, host, credentials: nil, port: nil, database: nil, **options self.new( uri_klass.build( scheme: scheme, - userinfo: credentials&.join(":"), host: host, port: port, path: path, From 53808c76fce1e3b31bf6b39670b5b977da79ae0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Lled=C3=B3?= Date: Wed, 20 Aug 2025 10:31:18 +0200 Subject: [PATCH 2/2] Fix failing tests --- test/async/redis/endpoint.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/async/redis/endpoint.rb b/test/async/redis/endpoint.rb index f1ea469..445ca9c 100644 --- a/test/async/redis/endpoint.rb +++ b/test/async/redis/endpoint.rb @@ -106,8 +106,7 @@ it "handles credentials correctly" do endpoint = Async::Redis::Endpoint.for("redis", "localhost", credentials: ["user", "pass"], port: 6380) - expect(endpoint.url.to_s).to be == "redis://user:pass@localhost:6380" - expect(endpoint.url.userinfo).to be == "user:pass" + expect(endpoint.url.to_s).to be == "redis://localhost:6380" expect(endpoint.credentials).to be == ["user", "pass"] end @@ -131,11 +130,10 @@ port: 6380, database: 3 ) - expect(endpoint.url.to_s).to be == "rediss://user:pass@[#{ipv6}]:6380/3" + expect(endpoint.url.to_s).to be == "rediss://[#{ipv6}]:6380/3" expect(endpoint.url.scheme).to be == "rediss" expect(endpoint.url.host).to be == "[#{ipv6}]" expect(endpoint.url.hostname).to be == ipv6 - expect(endpoint.url.userinfo).to be == "user:pass" expect(endpoint.url.port).to be == 6380 expect(endpoint.url.path).to be == "/3" expect(endpoint).to be(:secure?)