-
Notifications
You must be signed in to change notification settings - Fork 353
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
JavaClient can stream the HTTP response body #1005
JavaClient can stream the HTTP response body #1005
Conversation
Is this ready for review? |
Hey @brianquinlan, There are a couple of In particular:
Thank you! |
} | ||
} finally { | ||
// TODO: Should we kill the isolate here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't it exit on it's own?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @brianquinlan,
I think it does exit on its own normally although I'm not 100% sure about when the user cancels the StreamSubscription
of the StreamedResponse.stream
. But perhaps we don't have to worry too much about this?
Can you edit the 1st message in the PR to be a description of the code changes that we can use as the commit message? |
Hey @natebosch, I've updated the 1st message in the PR. Thanks for the link, it was very helpful and I've bookmarked it for future reference 🔖. Thank you! |
Make java_http stream the HTTP response body one byte at a time. Currently, java_http
gets all the bytes of the HTTP response body and then creates a stream from these bytes.
Use
Isolate.spawn
instead ofIsolate.run
so that we can send more than one message from the worker isolate.Make the worker isolate send the HTTP response status code, reason phrase and response headers (in that order) to the main isolate.
The rest of the messages from the worker isolate are the HTTP response body bytes. Create the response body stream from these bytes.
Handle the worker isolate sending
ClientException
as well as the HTTP response data.Close the worker isolate if there is a
ClientException
when getting the HTTP response status code.Make java_http pass
testResponseBodyStreamed
inpackage:http_client_conformance_tests
.Relevant tracking issue: #957.
Contribution guidelines:
dart format
.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.