mirror of https://github.com/go-redis/redis.git
feat: add field protocol to setupClusterQueryParams (#2600)
This commit is contained in:
parent
391798880c
commit
840c25cb6f
|
@ -217,6 +217,7 @@ func setupClusterConn(u *url.URL, host string, o *ClusterOptions) (*ClusterOptio
|
|||
func setupClusterQueryParams(u *url.URL, o *ClusterOptions) (*ClusterOptions, error) {
|
||||
q := queryOptions{q: u.Query()}
|
||||
|
||||
o.Protocol = q.int("protocol")
|
||||
o.ClientName = q.string("client_name")
|
||||
o.MaxRedirects = q.int("max_redirects")
|
||||
o.ReadOnly = q.bool("read_only")
|
||||
|
|
|
@ -1519,6 +1519,10 @@ var _ = Describe("ClusterClient ParseURL", func() {
|
|||
test: "UseDefault",
|
||||
url: "redis://localhost:123?conn_max_idle_time=",
|
||||
o: &redis.ClusterOptions{Addrs: []string{"localhost:123"}, ConnMaxIdleTime: 0},
|
||||
}, {
|
||||
test: "Protocol",
|
||||
url: "redis://localhost:123?protocol=2",
|
||||
o: &redis.ClusterOptions{Addrs: []string{"localhost:123"}, Protocol: 2},
|
||||
}, {
|
||||
test: "ClientName",
|
||||
url: "redis://localhost:123?client_name=cluster_hi",
|
||||
|
|
Loading…
Reference in New Issue