🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@pierredup
Copy link
Contributor

Q A
Branch? 7.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #62166
License MIT

When registering a scoped client and enabling caching, the scoping client should decorate the caching one, while currently it's registered the wrong way around. This causes Invalid URL exceptions, since the URL is not resolved first by the scoping client

@carsonbot carsonbot added this to the 7.4 milestone Oct 27, 2025
@pierredup pierredup force-pushed the fix-http-client-scope-caching branch from 221dc18 to 5bb8918 Compare October 27, 2025 06:07
@nicolas-grekas nicolas-grekas changed the title [HttpClient] Fix caching client docrating scoping client [HttpClient] Fix caching client decorating scoping client Oct 27, 2025
@nicolas-grekas nicolas-grekas force-pushed the fix-http-client-scope-caching branch from 5bb8918 to aeb55c4 Compare October 27, 2025 17:57
@nicolas-grekas
Copy link
Member

I checked out the code on a test app and figured your initial patch didn't work. I force-pushed a new one.
Can you please have a look and fix tests? 🙏

@nicolas-grekas nicolas-grekas force-pushed the fix-http-client-scope-caching branch from 6e5a9ee to bfde962 Compare October 28, 2025 09:28
@nicolas-grekas
Copy link
Member

Thank you @pierredup.

@nicolas-grekas nicolas-grekas merged commit 8930ff8 into symfony:7.4 Oct 28, 2025
12 checks passed
@pierredup pierredup deleted the fix-http-client-scope-caching branch October 28, 2025 10:48
$retryOptions = $scopeConfig['retry_failed'] ?? ['enabled' => false];
unset($scopeConfig['retry_failed']);

$transport = $name.'.transport';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of introducing this separate service, we could register $name with the initial service (which could even be a DI alias instead of this current() hack in the factory) and then registering ScopingHttpClient as a decorator of that service, allowing to configure the decoration priority even for cases where ScopingHttpClient should not be the outer one (see UriTemplateHttpClient which is still on the outside).

alexandre-daubois added a commit that referenced this pull request Oct 29, 2025
…olas-grekas)

This PR was merged into the 7.4 branch.

Discussion
----------

[FrameworkBundle] Simplify wiring of scoped clients

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

As advised by `@stof` in #62169 (comment)

Commits
-------

f04c2a8 [FrameworkBundle] Simplify wiring of scoped clients
This was referenced Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[HttpClient] Scoped clients doesn't work with Caching HTTP Client

4 participants