In Guzzle 6.x, the save_to request option was deprecated in favor of sink. While GuzzleHttp\Client will accept save_to; it is mapped internally to sink within Client::transfer() prior to calling the handler.
Option handling within WyriHaximus\React\Guzzle\HttpClient\Request does not support sink.
$loop = React\EventLoop\Factory::create();
$handler = new WyriHaximus\React\GuzzlePsr7\HttpClientAdapter($loop);
$client = new GuzzleHttp\Client([
'handler' => \GuzzleHttp\HandlerStack::create($handler),
'debug' => true,
'sink' => 'file.txt',
]);
$start = time();
$client->getAsync('http://www.google.com')->then(function ($response) use ($start) {
printf('%d s have elapsed end of request'. PHP_EOL, time() - $start);
});
$loop->run();
printf('%d s have elapsed - end of application' . PHP_EOL, time() - $start);
This code sample will result in no file being created.
Expected output: 'file.txt' containing the response body of the http request.
In Guzzle 6.x, the
save_to
request option was deprecated in favor ofsink
. WhileGuzzleHttp\Client
will acceptsave_to
; it is mapped internally tosink
withinClient::transfer()
prior to calling the handler.Option handling within
WyriHaximus\React\Guzzle\HttpClient\Request
does not supportsink
.This code sample will result in no file being created.
Expected output: 'file.txt' containing the response body of the http request.