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
Response construction with ReadableStream #283
Conversation
@@ -3842,7 +3842,8 @@ <h4 id="should-response-to-request-be-blocked-due-to-nosniff?"><dfn title="shoul | |||
<h3>Body mixin</h3> | |||
|
|||
<pre class=idl>typedef any <dfn>JSON</dfn>; | |||
typedef (<span data-anolis-spec=fileapi>Blob</span> or BufferSource or <span data-anolis-spec=xhr>FormData</span> or <span data-anolis-spec=url>URLSearchParams</span> or USVString) <dfn>BodyInit</dfn>;</pre> | |||
typedef (<span data-anolis-spec=fileapi>Blob</span> or BufferSource or <span data-anolis-spec=xhr>FormData</span> or <span data-anolis-spec=url>URLSearchParams</span> or USVString) <dfn>RequestBodyInit</dfn>; | |||
typedef (<span data-anolis-spec=fileapi>Blob</span> or BufferSource or <span data-anolis-spec=xhr>FormData</span> or <span data-anolis-spec=url>URLSearchParams</span> or USVString or <code title=concept-ReadableStream>ReadableStream</code>) <dfn>ResponseBodyInit</dfn>;</pre> |
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.
Why not typedef (<span>BodyInit</span> or <span title=concept-ReadableStream>ReadableStream</span>) <dfn>ResponseBodyInit</dfn>
or just inline that for the Response
constructor since it's only used once? Changing BodyInit
is problematic since other specifications use it too.
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.
Fixed. I'd like to define ResponseBodyInit here because with ResponseBodyInit it's easier to understand why we have ReadableStream clause in "extract a body and a Content-Type value" algorithm.
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.
Fair.
@@ -3842,7 +3842,8 @@ <h4 id="should-response-to-request-be-blocked-due-to-nosniff?"><dfn title="shoul | |||
<h3>Body mixin</h3> | |||
|
|||
<pre class=idl>typedef any <dfn>JSON</dfn>; | |||
typedef (<span data-anolis-spec=fileapi>Blob</span> or BufferSource or <span data-anolis-spec=xhr>FormData</span> or <span data-anolis-spec=url>URLSearchParams</span> or USVString) <dfn>BodyInit</dfn>;</pre> | |||
typedef (<span data-anolis-spec=fileapi>Blob</span> or BufferSource or <span data-anolis-spec=xhr>FormData</span> or <span data-anolis-spec=url>URLSearchParams</span> or USVString) <dfn>BodyInit</dfn>; | |||
typedef (<span>BodyInit</span> or <code title=concept-ReadableStream>ReadableStream</code>) <dfn>ResponseBodyInit</dfn>;</pre> |
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.
I was about to merge, but you need to use <span>
inside <pre>
, not <code>
. Otherwise the coloring gets weird. A <pre class=idl>
block is code already in a way.
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.
I see, thanks. Fixed.
\o/ |
Thank you! |
This change enables constructing a Response from ReadableStream, as discussed in
yutakahirano/fetch-with-streams#63.