Skip to content

Commit

Permalink
request() needs Request as the parameter, not a string
Browse files Browse the repository at this point in the history
$client->request now uses a Request as the parameter, not a url string
  • Loading branch information
ktecho committed Dec 23, 2020
1 parent 1c1f383 commit 80347c6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/concurrent.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ $promises = [];
$urls = ['https://github.com/', 'https://google.com/', 'https://amphp.org/http-client'];
foreach ($urls as $url) {
$promises[$url] = Amp\call(static function () use ($client, $url) {
$request = new Request($url);
// "yield" inside a coroutine awaits the resolution of the promise
// returned from Client::request(). The generator is then continued.
$response = yield $client->request($url);
$response = yield $client->request($request);

// Same for the body here.
$body = yield $response->getBody()->buffer();
Expand Down

0 comments on commit 80347c6

Please sign in to comment.