@@ -775,8 +775,9 @@ SSRF (Server-side request forgery) Handling
775
775
requests to an arbitrary domain. These attacks can also target the internal
776
776
hosts and IPs of the attacked server.
777
777
778
- If you use an ``HttpClient `` together with user-provided URIs, it is probably a
779
- good idea to decorate it with a ``NoPrivateNetworkHttpClient ``. This will
778
+ If you use an :class: `Symfony\\ Component\\ HttpClient\\ HttpClient ` together
779
+ with user-provided URIs, it is probably a good idea to decorate it with a
780
+ :class: `Symfony\\ Component\\ HttpClient\\ NoPrivateNetworkHttpClient `. This will
780
781
ensure local networks are made inaccessible to the HTTP client::
781
782
782
783
use Symfony\Component\HttpClient\HttpClient;
@@ -848,8 +849,8 @@ Configuring CurlHttpClient Options
848
849
849
850
PHP allows to configure lots of `cURL options `_ via the :phpfunction: `curl_setopt `
850
851
function. In order to make the component more portable when not using cURL, the
851
- `` CurlHttpClient `` only uses some of those options (and they are ignored in the
852
- rest of clients).
852
+ :class: ` Symfony \\ Component \\ HttpClient \\ CurlHttpClient ` only uses some of those
853
+ options (and they are ignored in the rest of clients).
853
854
854
855
Add an ``extra.curl `` option in your configuration to pass those extra options::
855
856
@@ -1030,7 +1031,8 @@ Canceling Responses
1030
1031
1031
1032
To abort a request (e.g. because it didn't complete in due time, or you want to
1032
1033
fetch only the first bytes of the response, etc.), you can either use the
1033
- ``cancel() `` method of ``ResponseInterface ``::
1034
+ ``cancel() `` method of
1035
+ :class: `Symfony\\ Contracts\\ HttpClient\\ ResponseInterface `::
1034
1036
1035
1037
$response->cancel();
1036
1038
@@ -1044,7 +1046,8 @@ Or throw an exception from a progress callback::
1044
1046
},
1045
1047
]);
1046
1048
1047
- The exception will be wrapped in an instance of ``TransportExceptionInterface ``
1049
+ The exception will be wrapped in an instance of
1050
+ :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ TransportExceptionInterface `
1048
1051
and will abort the request.
1049
1052
1050
1053
In case the response was canceled using ``$response->cancel() ``,
@@ -1244,7 +1247,8 @@ that network errors can happen when calling e.g. ``getStatusCode()`` too::
1244
1247
Because ``$response->getInfo() `` is non-blocking, it shouldn't throw by design.
1245
1248
1246
1249
When multiplexing responses, you can deal with errors for individual streams by
1247
- catching ``TransportExceptionInterface `` in the foreach loop::
1250
+ catching :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ TransportExceptionInterface `
1251
+ in the foreach loop::
1248
1252
1249
1253
foreach ($client->stream($responses) as $response => $chunk) {
1250
1254
try {
@@ -1384,9 +1388,9 @@ PSR-18 and PSR-17
1384
1388
1385
1389
This component implements the `PSR-18 `_ (HTTP Client) specifications via the
1386
1390
:class: `Symfony\\ Component\\ HttpClient\\ Psr18Client ` class, which is an adapter
1387
- to turn a Symfony `` HttpClientInterface `` into a PSR-18 `` ClientInterface ``.
1388
- This class also implements the relevant methods of ` PSR-17 `_ to ease creating
1389
- request objects.
1391
+ to turn a Symfony :class: ` Symfony \\ Contracts \\ HttpClient \\ HttpClientInterface `
1392
+ into a PSR-18 `` ClientInterface ``. This class also implements the relevant
1393
+ methods of ` PSR-17 `_ to ease creating request objects.
1390
1394
1391
1395
To use it, you need the ``psr/http-client `` package and a `PSR-17 `_ implementation:
1392
1396
@@ -1468,9 +1472,9 @@ The `HTTPlug`_ v1 specification was published before PSR-18 and is superseded by
1468
1472
it. As such, you should not use it in newly written code. The component is still
1469
1473
interoperable with libraries that require it thanks to the
1470
1474
:class: `Symfony\\ Component\\ HttpClient\\ HttplugClient ` class. Similarly to
1471
- `` Psr18Client `` implementing relevant parts of PSR-17, `` HttplugClient `` also
1472
- implements the factory methods defined in the related `` php-http/message-factory ``
1473
- package.
1475
+ :class: ` Symfony \\ Component \\ HttpClient \\ Psr18Client ` implementing relevant parts of PSR-17,
1476
+ `` HttplugClient `` also implements the factory methods defined in the related
1477
+ `` php-http/message-factory `` package.
1474
1478
1475
1479
.. code-block :: terminal
1476
1480
@@ -1692,15 +1696,20 @@ has many safety checks that will throw a ``LogicException`` if the chunk
1692
1696
passthru doesn't behave correctly; e.g. if a chunk is yielded after an ``isLast() ``
1693
1697
one, or if a content chunk is yielded before an ``isFirst() `` one, etc.
1694
1698
1699
+ .. versionadded :: 5.2
1700
+
1701
+ :class: `Symfony\\ Component\\ HttpClient\\ AsyncDecoratorTrait ` was introduced in Symfony 5.2.
1702
+
1695
1703
Testing
1696
1704
-------
1697
1705
1698
- This component includes the ``MockHttpClient `` and ``MockResponse `` classes to
1699
- use in tests that shouldn't make actual HTTP requests. Such tests can be
1700
- useful, as they will run faster and produce consistent results, since they're
1701
- not dependent on an external service. By not making actual HTTP requests there
1702
- is no need to worry about the service being online or the request changing
1703
- state, for example deleting a resource.
1706
+ This component includes the :class: `Symfony\\ Component\\ HttpClient\\ MockHttpClient `
1707
+ and :class: `Symfony\\ Component\\ HttpClient\\ Response\\ MockResponse ` classes to use
1708
+ in tests that shouldn't make actual HTTP requests. Such tests can be useful, as they
1709
+ will run faster and produce consistent results, since they're not dependent on an
1710
+ external service. By not making actual HTTP requests there is no need to worry about
1711
+ the service being online or the request changing state, for example deleting
1712
+ a resource.
1704
1713
1705
1714
``MockHttpClient `` implements the ``HttpClientInterface ``, just like any actual
1706
1715
HTTP client in this component. When you type-hint with ``HttpClientInterface ``
0 commit comments