You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #30752 [HttpClient] use "nyholm/psr7" by default in Psr18Client (nicolas-grekas)
This PR was merged into the 4.3-dev branch.
Discussion
----------
[HttpClient] use "nyholm/psr7" by default in Psr18Client
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This makes the factory arguments of `Psr18Client` optional, with a fallback to using `Nyholm\Psr7\Factory\Psr17Factory` when no factories are provided.
Commits
-------
f2222e4 [HttpClient] use "nyholm/psr7" by default in Psr18Client
thrownew \LogicException('You cannot use the "Symfony\Component\HttpClient\Psr18Client" as the "psr/http-client" package is not installed. Try running "composer require psr/http-client".');
27
+
}
28
+
24
29
/**
25
30
* An adapter to turn a Symfony HttpClientInterface into a PSR-18 ClientInterface.
26
31
*
@@ -38,11 +43,23 @@ final class Psr18Client implements ClientInterface
if (null !== $this->responseFactory && null !== $this->streamFactory) {
53
+
return;
54
+
}
55
+
56
+
if (!class_exists(Psr17Factory::class)) {
57
+
thrownew \LogicException('You cannot use the "Symfony\Component\HttpClient\Psr18Client" as no PSR-17 factories have been provided. Try running "composer require nyholm/psr7".');
0 commit comments