我正在尝试在config.yml
8p Guzzle
捆绑(https://github.com/8p/GuzzleBundle)中设置一个变量,如下所示:
guzzle:
clients:
identity_api:
base_url: "%some.url%:5000/v2.0"
并做一个典型的获取:
$client = $this->container->get('guzzle.client.identity_api');
$response = $client->get('/users')
但是我收到一个错误,告诉我要求的网址是:
http://somedomain.com:5000/users
我认为是slash
的东西,我试图用反斜杠来代替,但没有。
答案 0 :(得分:0)
我的错误,跟随http://docs.guzzlephp.org/en/latest/quickstart.html#making-a-request
base_uri URI Result
http://foo.com /bar http://foo.com/bar
http://foo.com/foo /bar http://foo.com/bar
http://foo.com/foo bar http://foo.com/bar
http://foo.com/foo/ bar http://foo.com/foo/bar
http://foo.com http://baz.com http://baz.com
http://foo.com/?bar bar http://foo.com/bar
我必须删除用户请求的slash
。
$client = $this->container->get('guzzle.client.identity_api');
$response = $client->get('users')