When I run the following code (using the latest Guzzle, v6), the requested URL http://example.com/foobar?foo=bar removes boo=far from the request.
$guzzle_http_client = new GuzzleHttp\Client([ 'base_uri' => 'http://example.com/', 'query' => [ 'foo' => 'bar' ], ]); $request = new \GuzzleHttp\Psr7\Request('GET', 'foobar?boo=far'); $response = $guzzle_http_client->send($request);
When I run the following code, passing boo=far instead as part of the Client::send() method, the requested URL is http://example.com/foobar?boo=far
$guzzle_http_client = new GuzzleHttp\Client([ 'base_uri' => 'http://example.com/', 'query' => [ 'foo' => 'bar' ], ]); $request = new \GuzzleHttp\Psr7\Request('GET', 'foobar'); $response = $guzzle_http_client->send($request, ['query' => ['boo' => 'far']]);
Of course, the URL I want to get is:
http:
How to get Guzzle to combine default client request string parameters with query parameters?
source share