-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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:valid
66A8
ateAddress?key=<redacted>
Possible Solution
I guess that the parsing of the URL done in
| private static function parseUrl(string $url, array $query = [], array $allowedSchemes = ['http' => 80, 'https' => 443]): array |
Additional Context
No response