- From: Anne van Kesteren <notifications@github.com>
- Date: Wed, 24 May 2023 10:37:29 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/pull/1657/review/1442429410@github.com>
@annevk commented on this pull request.
Pretty close now!
> @@ -7178,6 +7174,22 @@ returns failure or a <a for=/>MIME type</a>.
<hr>
+<div algorithm>
+<p>To <dfn id=concept-body-get-mime-type for=Body>get the MIME type</dfn>, given a {{Request}}
+or {{Response}} object, <var>requestOrResponse</var>, run these steps:
+
+<ol>
+ <li><p>Let <var>headers</var> be null
```suggestion
<li><p>Let <var>headers</var> be null.
```
Also, typically `<li>`s are separated by a newline.
> @@ -7178,6 +7174,22 @@ returns failure or a <a for=/>MIME type</a>.
<hr>
+<div algorithm>
+<p>To <dfn id=concept-body-get-mime-type for=Body>get the MIME type</dfn>, given a {{Request}}
+or {{Response}} object, <var>requestOrResponse</var>, run these steps:
+
+<ol>
+ <li><p>Let <var>headers</var> be null
+ <li><p>If <var>requestOrResponse</var> is a {{Request}} object, then set <var>headers</var> to
+ <var>requestOrResponse</var>'s <a for=Request>request</a>'s {{Request/headers}}.
The last one here needs to be `<a for=request>header list</a>`. Similar error for response below.
> @@ -7178,6 +7174,22 @@ returns failure or a <a for=/>MIME type</a>.
<hr>
+<div algorithm>
+<p>To <dfn id=concept-body-get-mime-type for=Body>get the MIME type</dfn>, given a {{Request}}
+or {{Response}} object, <var>requestOrResponse</var>, run these steps:
+
+<ol>
+ <li><p>Let <var>headers</var> be null
+ <li><p>If <var>requestOrResponse</var> is a {{Request}} object, then set <var>headers</var> to
+ <var>requestOrResponse</var>'s <a for=Request>request</a>'s {{Request/headers}}.
+ <li><p>Otherwise, set <var>headers</var> to <var>requestOrResponse</var>'s <a for=Response>
+ response</a>'s {{Response/headers}}.
+ <li><p>Let <var>mimeTypeInHeaders</var> be the result of <a for="header list">extracting a
+ MIME type</a> from <var>headers</var>.
No newlines in phrasing-level elements to make inline search not require a regex.
> @@ -7234,22 +7246,28 @@ of running <a for=Body>consume body</a> with <a>this</a> and the following step
<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>.
+and whose {{Blob/type}} attribute is to <a for=Body>get the MIME type</a> with <a>this</a>.
Please add something like:
`<!-- This is wrong. It should really set an underlying concept to this. -->`
It's an existing issue and would be quite involved to fix, but we should acknowledge it.
> +<li><p>If <var>mimeType</var> is null, then <a>Throw</a> a {{TypeError}}.
+<li>
+ <p>Otherwise, switch on <var>mimeType</var>'s <a for="MIME type">essence</a> and run the
+ corresponding steps:
Here's what I think I would do
| If mimeType is non-null, then switch on _mimeType_'s essence and run the ...
and then you remove the "Otherwise" from the list and instead end with a "Throw" step.
The one unfortunate thing about all this is that you'll have to adjust indentation, which might require rewrapping due to 100 columns. If that seems like too much of a challenge I'm happy to do that for you though near the end.
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1657#pullrequestreview-1442429410
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/fetch/pull/1657/review/1442429410@github.com>
Received on Wednesday, 24 May 2023 17:37:34 UTC