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