-
Notifications
You must be signed in to change notification settings - Fork 133
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
Use Fetch's body read algorithms #313
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
annevk
added a commit
to whatwg/fetch
that referenced
this pull request
Feb 20, 2021
This refactoring allows specifications building on top of Fetch to avoid having to directly integrate with Streams. It makes these changes: * body's transmitted bytes is removed. body's total bytes will likely be removed in #604. * body's done and wait concepts are removed. * It introduces three primitives to read a body: incrementally read (process each chunk), fully read (get all), and fully reading body as promise (get all as promise). * Removed transmit request body in favor of HTTP-network fetch using incrementally read directly to transmit the request body. * Fetch's processRequestBody and processRequestEndOfBody are no longer passed a request. The former is passed the chunk length for progress reporting. (Needed by XMLHttpRequest.) * Fetch's processResponseEndOfBody when passed will now cause the body to be fully read and will pass the result in the second argument. (This means that callers can no longer read the body themselves.) * Subresource Integrity changed slightly with Fetch handing it the bytes and integrity metadata and no longer a response. Essentially fetch fully reads the body, does the check, and then creates a new body from the same bytes to hand to the caller. Subresoruce Integrity PR: w3c/webappsec-subresource-integrity#97. XMLHttpRequest PR: whatwg/xhr#313. Closes #661.
domenic
approved these changes
Feb 22, 2021
annevk
added a commit
to whatwg/fetch
that referenced
this pull request
Feb 24, 2021
This refactoring allows specifications building on top of Fetch to avoid having to directly integrate with Streams. It makes these changes: * body's transmitted bytes is removed. body's total bytes will likely be removed in #604. * body's done and wait concepts are removed. * It introduces three primitives to read a body: incrementally read (process each chunk), fully read (get all), and fully reading body as promise (get all as promise). * Removed transmit request body in favor of HTTP-network fetch using incrementally read directly to transmit the request body. * Fetch's processRequestBody and processRequestEndOfBody are no longer passed a request. The former is passed the chunk length for progress reporting. (Needed by XMLHttpRequest.) * Fetch's processResponseEndOfBody when passed will now cause the body to be fully read and will pass the result in the second argument. (This means that callers can no longer read the body themselves.) * Subresource Integrity changed slightly with Fetch handing it the bytes and integrity metadata and no longer a response. Essentially fetch fully reads the body, does the check, and then creates a new body from the same bytes to hand to the caller. Subresoruce Integrity PR: w3c/webappsec-subresource-integrity#97. XMLHttpRequest PR: whatwg/xhr#313. Closes #661.
annevk
added a commit
to whatwg/fetch
that referenced
this pull request
Feb 24, 2021
This refactoring allows specifications building on top of Fetch to avoid having to directly integrate with Streams. It makes these changes: * body's transmitted bytes is removed. body's total bytes will likely be removed in #604. * body's done and wait concepts are removed. * It introduces three primitives to read a body: incrementally read (process each chunk), fully read (get all), and fully reading body as promise (get all as promise). * Removed transmit request body in favor of HTTP-network fetch using incrementally read directly to transmit the request body. * Fetch's processRequestBody and processRequestEndOfBody are no longer passed a request. The former is passed the chunk length for progress reporting. (Needed by XMLHttpRequest.) * Fetch's processResponseEndOfBody when passed will now cause the body to be fully read and will pass the result in the second argument. (This means that callers can no longer read the body themselves.) * Subresource Integrity changed slightly with Fetch handing it the bytes and integrity metadata, and no longer a response. Essentially fetch fully reads the body, does the check, and then creates a new body from the same bytes to hand to the caller. Subresoruce Integrity PR: w3c/webappsec-subresource-integrity#97. XMLHttpRequest PR: whatwg/xhr#313. Closes #661.
An error while reading body seems ignored in the synchronous case. |
@yutakahirano yeah, could you file an issue on that? That's what the current text suggests as well, but I suspect we might want to rethrow or some such? |
yutakahirano
approved these changes
Feb 25, 2021
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.
Ah, I didn't notice it was already broken. Filed #314. LGTM.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fails the build because the Fetch change hasn't landed yet.
Preview | Diff