Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitea04279

Browse files
committed
minor#11663 [HttpClient] Documented the cancel() method (javiereguiluz)
This PR was merged into the 4.4 branch.Discussion----------[HttpClient] Documented the cancel() methodFixes#11658.Commits-------a983ece [HttpClient] Documented the cancel() method
2 parentse0a86d1 +a983ece commitea04279

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎components/http_client.rst‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,23 @@ the "foreach" in the snippet with this one, the code becomes fully async::
380380
Use the ``user_data`` option combined with ``$response->getInfo('user_data')``
381381
to track the identity of the responses in your foreach loops.
382382

383+
Canceling Responses
384+
~~~~~~~~~~~~~~~~~~~
385+
386+
Responses can be canceled at any moment before they are completed using the
387+
``cancel()`` method::
388+
389+
foreach ($client->stream($responses) as $response => $chunk) {
390+
// ...
391+
392+
// if some condition happens, cancel the response
393+
$response->cancel();
394+
}
395+
396+
..versionadded::4.4
397+
398+
The ``cancel()`` method was introduced in Symfony 4.4.
399+
383400
Dealing with Network Timeouts
384401
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
385402

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp