Re: [whatwg/fetch] [draft] Pass in content type to resource-timing (PR #1481)

@abinpaul1 commented on this pull request.



> @@ -4383,6 +4383,13 @@ steps:
 
      <li><p>Let <var>bodyInfo</var> be <var>response</var>'s <a for=response>body info</a>.
 
+     <li><p>Let <var>mimeType</var> be the empty string if <var>fetchParams</var>'s
+     <a for="fetch params">request</a>'s <a for=request>mode</a> is "<code>navigate</code>" and
+     <var>response</var>'s <a for=response>URL</a>'s <a for=url>origin</a> is not
+     <a>same origin</a> with <var>request</var>'s <a for=request>origin</a>, and
+     result of <a for="header list">extracting a MIME type</a> from <var>response</var>'s

Yeah, when it's opaque we have to keep an empty string. 

This seems to effectively be the same condition that we are applying to `responseStatus` as well. Would it make sense to keep the result of this condition in a variable and use it to determine `responseStatus`, `contentType` and others fields if any that would have to be gated on CORS.

Something like : 
Let _shouldReport_ be `true` if response's type is  "opaque"  or  fetchParams ’s request ’s mode is "navigate " and  response’s url ’s origin is not same origin with  request’s origin, and `false` otherwise.

Let _mimeType_ be result of extracting a MIME type from response’s  header list if _shouldReport_ is true and 0 otherwise.

Let _responseStatus_ be response's status if _shouldReport_ is true and 0 otherwise.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1481#discussion_r961858828

You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1481/review/1095130771@github.com>

Received on Friday, 2 September 2022 16:50:42 UTC