Skip to content

Commit ecce390

Browse files
committed
Define get(All)ResponseHeader(s) in terms of Fetch
Fixes #50.
1 parent 4be9ce5 commit ecce390

File tree

2 files changed

+68
-42
lines changed

2 files changed

+68
-42
lines changed

Overview.html

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,19 +1335,15 @@ <h4 id="the-getresponseheader()-method"><span class="secno">4.6.4 </span>The <co
13351335

13361336
<ol>
13371337
<li><p>If <a href="#response">response</a>'s
1338-
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-response-header-list" title="concept-response-header-list">header list</a> has
1339-
multiple <a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-header" title="concept-header">headers</a> whose
1340-
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-header-name" title="concept-header-name">name</a> is <var>name</var>,
1341-
return their <a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-header-value" title="concept-header-value">values</a> in
1342-
list order as a single byte sequence separated from each other by a 0x2C 0x20 byte pair.
1343-
1344-
<li><p>If <a href="#response">response</a>'s
1345-
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-response-header-list" title="concept-response-header-list">header list</a> has
1346-
one <a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-header" title="concept-header">header</a> whose
1347-
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-header-name" title="concept-header-name">name</a> is <var>name</var>,
1348-
return its <a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-header-value" title="concept-header-value">value</a>.
1349-
1350-
<li><p>Return null.
1338+
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-response-header-list" title="concept-response-header-list">header list</a> has <em>no</em>
1339+
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-header" title="concept-header">header</a> whose
1340+
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-header-name" title="concept-header-name">name</a> is <var>name</var>, then return
1341+
null.
1342+
1343+
<li><p>Return the
1344+
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-header-value-combined" title="concept-header-value-combined">combined value</a> given
1345+
<var>name</var> and <a href="#response">response</a>'s
1346+
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-response-header-list" title="concept-response-header-list">header list</a>.
13511347
</ol>
13521348

13531349
<p class="note no-backref">The Fetch Standard filters <a href="#response">response</a>'s
@@ -1378,14 +1374,31 @@ <h4 id="the-getallresponseheaders()-method"><span class="secno">4.6.5 </span>The
13781374

13791375
<p>The
13801376
<dfn id="dom-xmlhttprequest-getallresponseheaders" title="dom-XMLHttpRequest-getAllResponseHeaders"><code>getAllResponseHeaders()</code></dfn>
1381-
method must return <a href="#response">response</a>'s
1382-
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-response-header-list" title="concept-response-header-list">header list</a>, in
1383-
list order, as a single byte sequence with each
1384-
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-header" title="concept-header">header</a> separated by a 0x0D 0x0A
1385-
byte pair, and each <a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-header-name" title="concept-header-name">name</a> and
1386-
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-header-value" title="concept-header-value">value</a> of a
1387-
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-header" title="concept-header">header</a> separated by a 0x3A 0x20
1388-
byte pair.
1377+
method, when invoked, must run these steps:</p>
1378+
1379+
<ol>
1380+
<li><p>Let <var>output</var> be an empty byte sequence.
1381+
1382+
<li><p>Let <var>headers</var> be the result of running
1383+
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine" title="concept-header-list-sort-and-combine">sort and combine</a>
1384+
with <a href="#response">response</a>'s
1385+
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-response-header-list" title="concept-response-header-list">header list</a>.
1386+
1387+
<li>
1388+
<p>For each <var>header</var> in <var>headers</var>, run these substeps:
1389+
1390+
<ol>
1391+
<li><p>Append <var>header</var>'s
1392+
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-header-name" title="concept-header-name">name</a>, followed by a 0x3A 0x20 byte
1393+
pair, followed by <var>header</var>'s
1394+
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-header-value" title="concept-header-value">value</a>, to <var>output</var>.
1395+
1396+
<li><p>If <var>header</var> is not the last pair in <var>headers</var>, then append a 0x0D 0x0A
1397+
byte pair, to <var>output</var>.
1398+
</ol>
1399+
1400+
<li><p>Return <var>output</var>.
1401+
</ol>
13891402

13901403
<p class="note no-backref">The Fetch Standard filters <a href="#response">response</a>'s
13911404
<a class="external" data-anolis-spec="fetch" href="https://fetch.spec.whatwg.org/#concept-response-header-list" title="concept-response-header-list">header list</a>.

Overview.src.html

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,19 +1287,15 @@ <h4>The <code title>getResponseHeader()</code> method</h4>
12871287

12881288
<ol>
12891289
<li><p>If <span>response</span>'s
1290-
<span data-anolis-spec=fetch title=concept-response-header-list>header list</span> has
1291-
multiple <span data-anolis-spec=fetch title=concept-header>headers</span> whose
1292-
<span data-anolis-spec=fetch title=concept-header-name>name</span> is <var>name</var>,
1293-
return their <span data-anolis-spec=fetch title=concept-header-value>values</span> in
1294-
list order as a single byte sequence separated from each other by a 0x2C 0x20 byte pair.
1295-
1296-
<li><p>If <span>response</span>'s
1297-
<span data-anolis-spec=fetch title=concept-response-header-list>header list</span> has
1298-
one <span data-anolis-spec=fetch title=concept-header>header</span> whose
1299-
<span data-anolis-spec=fetch title=concept-header-name>name</span> is <var>name</var>,
1300-
return its <span data-anolis-spec=fetch title=concept-header-value>value</span>.
1301-
1302-
<li><p>Return null.
1290+
<span data-anolis-spec=fetch title=concept-response-header-list>header list</span> has <em>no</em>
1291+
<span data-anolis-spec=fetch title=concept-header>header</span> whose
1292+
<span data-anolis-spec=fetch title=concept-header-name>name</span> is <var>name</var>, then return
1293+
null.
1294+
1295+
<li><p>Return the
1296+
<span data-anolis-spec=fetch title=concept-header-value-combined>combined value</span> given
1297+
<var>name</var> and <span>response</span>'s
1298+
<span data-anolis-spec=fetch title=concept-response-header-list>header list</span>.
13031299
</ol>
13041300

13051301
<p class="note no-backref">The Fetch Standard filters <span>response</span>'s
@@ -1330,14 +1326,31 @@ <h4>The <code title>getAllResponseHeaders()</code> method</h4>
13301326

13311327
<p>The
13321328
<dfn title="dom-XMLHttpRequest-getAllResponseHeaders"><code>getAllResponseHeaders()</code></dfn>
1333-
method must return <span>response</span>'s
1334-
<span data-anolis-spec=fetch title=concept-response-header-list>header list</span>, in
1335-
list order, as a single byte sequence with each
1336-
<span data-anolis-spec=fetch title=concept-header>header</span> separated by a 0x0D 0x0A
1337-
byte pair, and each <span data-anolis-spec=fetch title=concept-header-name>name</span> and
1338-
<span data-anolis-spec=fetch title=concept-header-value>value</span> of a
1339-
<span data-anolis-spec=fetch title=concept-header>header</span> separated by a 0x3A 0x20
1340-
byte pair.
1329+
method, when invoked, must run these steps:</p>
1330+
1331+
<ol>
1332+
<li><p>Let <var>output</var> be an empty byte sequence.
1333+
1334+
<li><p>Let <var>headers</var> be the result of running
1335+
<span data-anolis-spec=fetch title=concept-header-list-sort-and-combine>sort and combine</span>
1336+
with <span>response</span>'s
1337+
<span data-anolis-spec=fetch title=concept-response-header-list>header list</span>.
1338+
1339+
<li>
1340+
<p>For each <var>header</var> in <var>headers</var>, run these substeps:
1341+
1342+
<ol>
1343+
<li><p>Append <var>header</var>'s
1344+
<span data-anolis-spec=fetch title=concept-header-name>name</span>, followed by a 0x3A 0x20 byte
1345+
pair, followed by <var>header</var>'s
1346+
<span data-anolis-spec=fetch title=concept-header-value>value</span>, to <var>output</var>.
1347+
1348+
<li><p>If <var>header</var> is not the last pair in <var>headers</var>, then append a 0x0D 0x0A
1349+
byte pair, to <var>output</var>.
1350+
</ol>
1351+
1352+
<li><p>Return <var>output</var>.
1353+
</ol>
13411354

13421355
<p class="note no-backref">The Fetch Standard filters <span>response</span>'s
13431356
<span data-anolis-spec=fetch title=concept-response-header-list>header list</span>.

0 commit comments

Comments
 (0)