Skip to content

Commit 516574c

Browse files
[HttpClient] Add support for pausing responses
1 parent 6e6565b commit 516574c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

http_client.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,10 @@ following methods::
10431043
// returns detailed logs about the requests and responses of the HTTP transaction
10441044
$httpLogs = $response->getInfo('debug');
10451045

1046+
// the special "pause_handler" info item is a callable that allows to delay the request
1047+
// this helps implement delayed retries or throttling streams for example
1048+
$response->getInfo('pause_handler')(2);
1049+
10461050
.. note::
10471051

10481052
``$response->toStream()`` is part of :class:`Symfony\\Component\\HttpClient\\Response\\StreamableInterface`.
@@ -1053,6 +1057,10 @@ following methods::
10531057
about the response. Some of them might not be known yet (e.g. ``http_code``)
10541058
when you'll call it.
10551059

1060+
.. versionadded:: 5.2
1061+
1062+
The ``pause_handler`` info item was introduced in Symfony 5.2.
1063+
10561064
.. _http-client-streaming-responses:
10571065

10581066
Streaming Responses

0 commit comments

Comments
 (0)