-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
await() doesn't work with streaming HTTP response body #27
Comments
@bileslaw Thank you for reporting, this is an interesting one! I could indeed reproduce the problem you're seeing and have managed to solve it like this: $browser = new React\Http\Browser();
$promise = $browser->requestStreaming(
'GET',
'https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_1920_18MG.mp4',
[
'Range' => 'bytes=0-499',
],
)->then(function (Psr\Http\Message\ResponseInterface $response) {
return React\Promise\Stream\buffer($response->getBody());
});
$body = React\Async\await($promise);
echo strlen($body), "\n"; // 0 This example should work just fine. That said, I consider your example to be reasonable and I would have expected this to work as well. I'll keep this ticket open for the reference and will look into addressing this in the underlying The underlying problem is that I've already patched this locally, but will do more tests first. Expect a PR in the next week or so 👍 |
@clue Great, thank you! |
@bileslaw Thank you! For reporting this 👍 . Really neat edge case you found there 👍 |
@bileslaw Again thanks for reporting! I've just filed #32 which should address this and make this work as expected, both within an |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
@bileslaw Thanks for giving this another try and confirming this works as expected now that your other problem has been addressed! 👍 |
Hello,
The code below doesn't work as expected.
At the end,
strlen()
should return a non-zero.Am I missing something maybe?
The text was updated successfully, but these errors were encountered: