Skip to content

[HttpClient] Invalid URL with scoped client defined with base_uri and caching #62590

@ker0x

Description

@ker0x

Symfony version(s) affected

7.4.0

Description

When defining a scoped client with a base_uri and caching, an InvalidArgumentException exception is thrown when making a request.

Invalid URL: scheme is missing in "/posts". Did you forget to add "http(s)://"?

Without caching, the request is perform as normal.

How to reproduce

Reproducer

framework:
  http_client:
    scoped_clients:
      example.client:
        base_uri: 'https://jsonplaceholder.typicode.com'
        headers:
          Accept: 'application/json'
        caching:
          cache_pool: example_cache_pool

    cache:
        pools:
            example_cache_pool:
              default_lifetime: 3600
              tags: true
$response = $exampleClient->request('GET', '/posts');

echo $response->getContent();

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions