- From: Anne van Kesteren <notifications@github.com>
- Date: Thu, 22 Dec 2022 03:15:17 -0800
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/pull/1569/review/1227495555@github.com>
@annevk commented on this pull request. I think this works, nice! Couple nits left. > - <dt><i>FormData</i> - <dd> - <p>If <var>mimeType</var>'s <a for="MIME type">essence</a> is "<code>multipart/form-data</code>", - then: + <li><p>If <var>object</var>'s <a for=Body>body</a> is null, then run <var>successSteps</var> + with an empty <a for=/>byte sequence</a>, and return. You need to return _promise_ here. > - <dt><i>FormData</i> - <dd> - <p>If <var>mimeType</var>'s <a for="MIME type">essence</a> is "<code>multipart/form-data</code>", - then: + <li><p>If <var>object</var>'s <a for=Body>body</a> is null, then run <var>successSteps</var> + with an empty <a for=/>byte sequence</a>, and return. + + <li>Let <var>errorSteps</var> given <var>error</var> be to <a>reject</a> <var>promise</var> with + <var>error</var>. If you define these before _successSteps_ you can invoke them as part of defining _successSteps_. > + <li><p>If <var>object</var>'s <a for=Body>body</a> is null, then run <var>successSteps</var> + with an empty <a for=/>byte sequence</a>, and return. + + <li>Let <var>errorSteps</var> given <var>error</var> be to <a>reject</a> <var>promise</var> with + <var>error</var>. + + <li><p><a for=body>Fully read</a> <var>object</var>'s <a for=Body>body</a> given + <var>successSteps</var>, <var>errorSteps</var>, and <var>object</var>'s + <a>relevant settings object</a>'s <a for="environment settings object">global object</a>. + + <li><p>Return <var>promise</var>. +</ol> + +<p>The <dfn method for=Body><code>arrayBuffer()</code></dfn> method steps are to return the result +of running <a for=Body>consume body</a> with <a>this</a> and the following step given a +<a for=/>byte sequence</a> <var>bytes</var>: Return a new {{ArrayBuffer}} whose contents are ```suggestion <a for=/>byte sequence</a> <var>bytes</var>: return a new {{ArrayBuffer}} whose contents are ``` > +<p>The <dfn method for=Body><code>blob()</code></dfn> method steps are to return the result +of running <a for=Body>consume body</a> with <a>this</a> and the following step given a +<a for=/>byte sequence</a> <var>bytes</var>: Return a {{Blob}} whose contents are <var>bytes</var> ```suggestion <a for=/>byte sequence</a> <var>bytes</var>: return a {{Blob}} whose contents are <var>bytes</var> ``` > +<p>The <dfn method for=Body><code>blob()</code></dfn> method steps are to return the result +of running <a for=Body>consume body</a> with <a>this</a> and the following step given a +<a for=/>byte sequence</a> <var>bytes</var>: Return a {{Blob}} whose contents are <var>bytes</var> +and whose {{Blob/type}} attribute is <a>this</a>'s <a for=Body>MIME type</a>. + +<p>The <dfn method for=Body><code>formData()</code></dfn> method steps are to return the result of +running <a for=Body>consume body</a> with <a>this</a> and the following step given a +<a for=/>byte sequence</a> <var>bytes</var>: switch on <a>this</a>'s <a for=Body>MIME type</a>'s +<a for="MIME type">essence</a>: and run the corresponding steps* > + <li>Let <var>errorSteps</var> given <var>error</var> be to <a>reject</a> <var>promise</var> with + <var>error</var>. + + <li><p><a for=body>Fully read</a> <var>object</var>'s <a for=Body>body</a> given + <var>successSteps</var>, <var>errorSteps</var>, and <var>object</var>'s + <a>relevant settings object</a>'s <a for="environment settings object">global object</a>. + + <li><p>Return <var>promise</var>. +</ol> + +<p>The <dfn method for=Body><code>arrayBuffer()</code></dfn> method steps are to return the result +of running <a for=Body>consume body</a> with <a>this</a> and the following step given a +<a for=/>byte sequence</a> <var>bytes</var>: Return a new {{ArrayBuffer}} whose contents are +<var>bytes</var>. + +<p class="note">The above method may <a>reject</a> with a {{RangeError}}. ```suggestion <p class="note">The above method can reject with a {{RangeError}}. ``` > -<p>The <dfn method for=Body><code>json()</code></dfn> method steps are to return the result of -running <a for=Body>consume body</a> with <a>this</a> and <i>JSON</i>. +<p class="note">The above method may <a>reject</a> with a {{SyntaxError}}. ```suggestion <p class="note">The above method can reject with a {{SyntaxError}}. ``` > +<p>The <dfn id=concept-body-consume-body for=Body>consume body</dfn> algorithm, given a {{Body}} +<var>object</var> and <var>convertBytesToJSValue</var>, which is an algorithm that accepts a +<a for=/>byte sequence</a> and returns a JavaScript value or throws an exception, runs these steps: ```suggestion <p id=concept-body-package-data>The <dfn id=concept-body-consume-body for=Body>consume body</dfn> algorithm, given an object that includes {{Body}} <var>object</var> and an algorithm that takes a <a for=/>byte sequence</a> and returns a JavaScript value or throws an exception <var>convertBytesToJSValue</var>, runs these steps: ``` -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/pull/1569#pullrequestreview-1227495555 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/fetch/pull/1569/review/1227495555@github.com>
Received on Thursday, 22 December 2022 11:15:31 UTC