Skip to content

The config of services.providers.address is unavailable for RPC Client#115

Closed
junler wants to merge 4 commits intohyperf:masterfrom
junler:patch-6
Closed

The config of services.providers.address is unavailable for RPC Client#115
junler wants to merge 4 commits intohyperf:masterfrom
junler:patch-6

Conversation

@junler
Copy link
Contributor

@junler junler commented Jul 2, 2019

修复services.php配置文件中address会被DEFAULT_URI覆盖的情况!

junler added 3 commits July 3, 2019 01:54
添加兼容consul包Client类中request方法的$options参数为空的情况,此处如果不加$options参数,之前在guzzlehttp的Client类的base_uri就会被覆盖!
兼容传入$options['base_uri']参数时$params['query']为空的情况
接收$options参数,避免guzzlehttp的Client类的base_uri被覆盖。现在的代码逻辑是consul包Client类中request方法的$options参数为空的情况就会使用默认的base_uri。
@limingxinleo
Copy link
Member

Agent::services() 是实现了对应接口的,顺便修改一下 AgentInterface

services()添加可选参数$options
@junler
Copy link
Contributor Author

junler commented Jul 3, 2019

已修改 AgentInterface 的services方法

@huangzhhui
Copy link
Member

@jungeFight 我还是不太理解这个问题要解决的点,你可以举一个使用场景并附上代码说明一下,如果不做此改动,出现问题是什么吗?

@junler
Copy link
Contributor Author

junler commented Jul 3, 2019

@huangzhhui 你可以初始化一个hyperf-skeleton的项目,用json-rpc调用发布到 consul的服务,就会发现services.php配置文件中的address值在request的时候会被覆盖!

@huangzhhui huangzhhui changed the title Patch 6 The config of services.providers.address is unavailable for RPC Client Jul 4, 2019
@limingxinleo
Copy link
Member

我去检查了这部分逻辑,我发现最终 request 确实会覆盖 base_uri。
但是关键问题不在这里,Hyperf\Consul\Client::request 不应该检测 options 中的 base_uri。我们应该在 ClientFactory 中就指定好对应的 base_uri。你看一下我连接过来的 pr。

@limingxinleo
Copy link
Member

refer #139

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants