Closed as not planned
Description
Symfony version(s) affected
6.4 and 7.0
Description
I'm using Google API for address validation. As referenced in their documentation, the URL to call is /v1:validateAddress
The problem is that HTTP client is trying to parse the URL without including the domain, so the part before the colon is interpreted as a schema, resulting in a "Unsupported scheme" HTTPException.
How to reproduce
Define an HTTP client like this:
framework:
http_client:
scoped_clients:
map_address.client:
base_uri: 'https://addressvalidation.googleapis.com/'
headers:
content-type: 'application/json'
accept: 'application/json'
then inject your client as HttpClientInterface $mapAddressClient
and try to use it:
$response = $this->mapAddressClient->request('POST', 'v1:validateAddress?key='.$myKey, [/* some data */]);
You'll get a Symfony\Component\HttpKernel\Exception\ HttpException
Unsupported scheme in "v1:validateAddress?key=<redacted>
Possible Solution
I guess that the parsing of the URL done in
should be always done using the full URL, including the schema and the domain, so basically including the configured "base_uri" option.Additional Context
No response