-
Notifications
You must be signed in to change notification settings - Fork 337
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
Formalize reading bodies #1172
Formalize reading bodies #1172
Conversation
672ed2e
to
c9fe740
Compare
I think this is getting somewhere, but:
It makes things more verbose for sure, but overall I think that is probably worth it. Early takes from @yutakahirano and @jakearchibald would also be welcome with regards to that. |
Corresponding Fetch PR: whatwg/fetch#1172. Closes #63. Helps with #83.
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.
Overall this looks good.
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.
LGTM with editorial suggestions
<li><p>Set <var>request</var>'s <a for=request>body</a> to <var>body</var>. | ||
</ol> | ||
<li><p>If <var>request</var>'s <a for=request>body</a> is a <a for=/>byte sequence</a>, then set | ||
<var>request</var>'s <a for=request>body</a> to the first return value of |
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.
"the first return value" seems pretty unusual; why not just "the result of"? Here and below.
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.
It returns two values. I'm aligning it with text elsewhere that uses this terminology.
9b06fa3
to
2c36ccb
Compare
Thanks, I addressed those comments. I also updated the first commit to include a longer description of the changes. |
Corresponding Fetch PR: whatwg/fetch#1172. Closes #63. Helps with #83.
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.
2c36ccb
to
cd84104
Compare
Closes #661.
Preview | Diff