Re: [whatwg/fetch] Override "Accept-Language" header if WebDriver BiDi emulated language is present. (PR #1869)

@annevk commented on this pull request.



> @@ -4659,10 +4659,28 @@ the response. [[!HTTP-CACHING]]
    <var>request</var>'s <a for=request>header list</a>.
   </ol>
 
- <li><p>If <var>request</var>'s <a for=request>header list</a>
- <a for="header list">does not contain</a> `<code>Accept-Language</code>`, then user agents should
- <a for="header list">append</a> (`<code>Accept-Language</code>, an appropriate
- <a for=/>header value</a>) to <var>request</var>'s <a for=request>header list</a>.
+ <li>
+  <p>If <var>request</var>'s <a for=request>header list</a> <a for="header list">does not contain</a> `<code>Accept-Language</code>`:
+
+  <ol>
+    <li>

Single-space indentation throughout.

> @@ -4659,10 +4659,28 @@ the response. [[!HTTP-CACHING]]
    <var>request</var>'s <a for=request>header list</a>.
   </ol>
 
- <li><p>If <var>request</var>'s <a for=request>header list</a>
- <a for="header list">does not contain</a> `<code>Accept-Language</code>`, then user agents should
- <a for="header list">append</a> (`<code>Accept-Language</code>, an appropriate
- <a for=/>header value</a>) to <var>request</var>'s <a for=request>header list</a>.
+ <li>
+  <p>If <var>request</var>'s <a for=request>header list</a> <a for="header list">does not contain</a> `<code>Accept-Language</code>`:
+
+  <ol>
+    <li>
+      <p>If <var>request</var>'s <a for=request>client</a> is non-null, then:

```suggestion
      <p>If <var>request</var>'s <a for=request>client</a> is non-null:
```

> @@ -4659,10 +4659,28 @@ the response. [[!HTTP-CACHING]]
    <var>request</var>'s <a for=request>header list</a>.
   </ol>
 
- <li><p>If <var>request</var>'s <a for=request>header list</a>
- <a for="header list">does not contain</a> `<code>Accept-Language</code>`, then user agents should
- <a for="header list">append</a> (`<code>Accept-Language</code>, an appropriate
- <a for=/>header value</a>) to <var>request</var>'s <a for=request>header list</a>.
+ <li>
+  <p>If <var>request</var>'s <a for=request>header list</a> <a for="header list">does not contain</a> `<code>Accept-Language</code>`:
+
+  <ol>
+    <li>
+      <p>If <var>request</var>'s <a for=request>client</a> is non-null, then:
+
+      <ol>
+        <li><p>Let <var>emulatedLanguage</var> be the <span>WebDriver BiDi emulated language</span>
+        for <var>request</var>'s <a for=request>client</a>

```suggestion
        for <var>request</var>'s <a for=request>client</a>.
```

> @@ -4659,10 +4659,28 @@ the response. [[!HTTP-CACHING]]
    <var>request</var>'s <a for=request>header list</a>.
   </ol>
 
- <li><p>If <var>request</var>'s <a for=request>header list</a>
- <a for="header list">does not contain</a> `<code>Accept-Language</code>`, then user agents should
- <a for="header list">append</a> (`<code>Accept-Language</code>, an appropriate
- <a for=/>header value</a>) to <var>request</var>'s <a for=request>header list</a>.
+ <li>
+  <p>If <var>request</var>'s <a for=request>header list</a> <a for="header list">does not contain</a> `<code>Accept-Language</code>`:
+
+  <ol>
+    <li>
+      <p>If <var>request</var>'s <a for=request>client</a> is non-null, then:
+
+      <ol>
+        <li><p>Let <var>emulatedLanguage</var> be the <span>WebDriver BiDi emulated language</span>

Needs to be `<a>` not `<span>`.

> +        <li><p>Otherwise, user agents should <a for="header list">append</a> (`<code>Accept-Language</code>, an appropriate
+        <a for=/>header value</a>) to <var>request</var>'s <a for=request>header list</a>.
+      </ol>
+
+    <li><p>Otherwise, user agents should <a for="header list">append</a> (`<code>Accept-Language</code>, an appropriate
+        <a for=/>header value</a>) to <var>request</var>'s <a for=request>header list</a>.

I think it would be better to check if header list contains Accept-Language again so we don't have to duplicate the appending logic. That would also allow us to merge some conditions.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1869#pullrequestreview-3369741899
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1869/review/3369741899@github.com>

Received on Thursday, 23 October 2025 12:44:56 UTC