1
0
mirror of https://github.com/danog/amp.git synced 2024-11-26 20:15:00 +01:00

Fix cancellation token example

This commit is contained in:
Niklas Keller 2017-05-16 21:46:52 +02:00
parent fdf18dedd7
commit 39dd36efdc

View File

@ -19,9 +19,10 @@ use function Amp\Promise\rethrow;
* **Example**
*
* ```php
* $cancellationTokenSource = new CancellationTokenSource;
* $tokenSource = new CancellationTokenSource;
* $token = $tokenSource->getToken();
*
* $response = yield $httpClient->request("https://example.com/stream");
* $response = yield $httpClient->request("https://example.com/stream", $token);
* $responseBody = $response->getBody();
*
* while (($chunk = yield $response->read()) !== null) {