@@ -1297,6 +1297,12 @@ null), run these steps. <var>processBody</var> must be an algorithm accepting a
1297
1297
1298
1298
<hr>
1299
1299
1300
+ <p> A <dfn export>body with type</dfn> is a <a for=/>tuple</a> that consists of a
1301
+ <dfn export for="body with type">body</dfn> (a <a for=/>body</a> ) and a
1302
+ <dfn export for="body with type">type</dfn> (a <a for=/>header value</a> or null).
1303
+
1304
+ <hr>
1305
+
1300
1306
<p> To <dfn export>handle content codings</dfn> given <var> codings</var> and <var> bytes</var> , run
1301
1307
these steps:
1302
1308
@@ -3881,8 +3887,8 @@ the request.
3881
3887
<var> crossOriginIsolatedCapability</var> .
3882
3888
3883
3889
<li><p> If <var> request</var> 's <a for=request>body</a> is a <a for=/>byte sequence</a> , then set
3884
- <var> request</var> 's <a for=request>body</a> to the first return value of
3885
- <a for=BodyInit>safely extracting</a> <var> request</var> 's <a for=request>body</a> .
3890
+ <var> request</var> 's <a for=request>body</a> to the <a for="body with type">body</a> of the result
3891
+ of <a for=BodyInit>safely extracting</a> <var> request</var> 's <a for=request>body</a> .
3886
3892
3887
3893
<li><p> If <var> request</var> 's <a for=request>window</a> is "<code> client</code> ", then set
3888
3894
<var> request</var> 's <a for=request>window</a> to <var>request</var>' s <a for=request>client</a> ,
@@ -4308,8 +4314,9 @@ steps:
4308
4314
<var> request</var> 's <a for=request>integrity metadata</a> , then run
4309
4315
<var> processBodyError</var> and abort these steps. [[!SRI]]
4310
4316
4311
- <li><p> Set <var> response</var> 's <a for=response>body</a> to the first return value of
4312
- <a for=BodyInit>safely extracting</a> <var> bytes</var> .
4317
+ <li><p> Set <var> response</var> 's <a for=response>body</a> to the
4318
+ <a for="body with type">body</a> of the result of <a for=BodyInit>safely extracting</a>
4319
+ <var> bytes</var> .
4313
4320
4314
4321
<li><p> Run <a>fetch response handover</a> given <var> fetchParams</var> and <var> response</var> .
4315
4322
</ol>
@@ -4850,8 +4857,9 @@ run these steps:
4850
4857
4851
4858
<li>
4852
4859
<p> If <var> request</var> 's <a for=request>body</a> is non-null, then set <var>request</var>' s
4853
- <a for=request>body</a> to the first return value of <a for=BodyInit>safely extracting</a>
4854
- <var> request</var> 's <a for=request>body</a>' s <a for=body>source</a> .
4860
+ <a for=request>body</a> to the <a for="body with type">body</a> of the result of
4861
+ <a for=BodyInit>safely extracting</a> <var> request</var> 's <a for=request>body</a>' s
4862
+ <a for=body>source</a> .
4855
4863
4856
4864
<p class="note no-backref"><var> request</var> 's <a for=request>body</a>' s <a for=body>source</a> 's
4857
4865
nullity has already been checked.
@@ -5351,9 +5359,9 @@ steps. They return a <a for=/>response</a>.
5351
5359
<li><p> If <var> request</var> 's <a for=request>body</a>' s <a for=body>source</a> is null,
5352
5360
then return a <a>network error</a> .
5353
5361
5354
- <li><p> Set <var> request</var> 's <a for=request>body</a> to the first return value of
5355
- <a for=BodyInit>safely extracting</a> <var> request</var> 's <a for=request>body</a >' s
5356
- <a for=body>source</a> .
5362
+ <li><p> Set <var> request</var> 's <a for=request>body</a> to the <a for="body with type">body</a>
5363
+ of the result of <a for=BodyInit>safely extracting</a> <var> request</var> 's
5364
+ <a for=request>body</a> 's <a for= body>source</a> .
5357
5365
</ol>
5358
5366
5359
5367
<li>
@@ -6451,9 +6459,8 @@ typedef (Blob or BufferSource or FormData or URLSearchParams or USVString) XMLHt
6451
6459
6452
6460
typedef (ReadableStream or XMLHttpRequestBodyInit) BodyInit;</pre>
6453
6461
6454
- <p> To <dfn for=BodyInit export>safely extract</dfn> a <a for=/>body</a> and a
6455
- `<code> Content-Type</code> ` <a for=/>header value</a> from a <a for=/>byte sequence</a> or
6456
- {{BodyInit}} object <var> object</var> , run these steps:
6462
+ <p> To <dfn for=BodyInit export>safely extract</dfn> a <a for=/>body with type</a> from a
6463
+ <a for=/>byte sequence</a> or {{BodyInit}} object <var> object</var> , run these steps:
6457
6464
6458
6465
<ol>
6459
6466
<li>
@@ -6464,15 +6471,15 @@ typedef (ReadableStream or XMLHttpRequestBodyInit) BodyInit;</pre>
6464
6471
<a for=ReadableStream>locked</a> .
6465
6472
</ol>
6466
6473
6467
- <li><p> Return the results of <a for=BodyInit>extracting</a> <var> object</var> .
6474
+ <li><p> Return the result of <a for=BodyInit>extracting</a> <var> object</var> .
6468
6475
</ol>
6469
6476
6470
6477
<p class="note no-backref"> The <a for=BodyInit>safely extract</a> operation is a subset of the
6471
6478
<a for=BodyInit>extract</a> operation that is guaranteed to not throw an exception.
6472
6479
6473
- <p> To <dfn id=concept-bodyinit-extract for=BodyInit export>extract</dfn> a <a for=/>body</a> and a
6474
- ` <code> Content-Type </code> ` < a for=/>header value </a> from a <a for=/>byte sequence</a> or
6475
- {{BodyInit}} object <var> object</var> , with an optional boolean
6480
+ <p> To <dfn id=concept-bodyinit-extract for=BodyInit export>extract</dfn> a
6481
+ < a for=/>body with type </a> from a <a for=/>byte sequence</a> or {{BodyInit}} object
6482
+ <var> object</var> , with an optional boolean
6476
6483
<dfn id=keepalive for=BodyInit/extract export><var>keepalive</var></dfn> (default false), run these
6477
6484
steps:
6478
6485
@@ -6487,7 +6494,7 @@ steps:
6487
6494
6488
6495
<li><p> Let <var> length</var> be null.
6489
6496
6490
- <li><p> Let <var> Content-Type </var> be null.
6497
+ <li><p> Let <var> type </var> be null.
6491
6498
6492
6499
<li>
6493
6500
<p> Switch on <var> object</var> :
@@ -6502,7 +6509,7 @@ steps:
6502
6509
<p> Set <var> length</var> to <var> object</var> 's {{Blob/size}} .
6503
6510
6504
6511
<p> If <var> object</var> 's {{Blob/type}}
6505
- attribute is not the empty byte sequence, set <var> Content-Type </var> to its value.
6512
+ attribute is not the empty byte sequence, set <var> type </var> to its value.
6506
6513
<!-- Blob reading is not defined and blobs don't have an internal data model to poke at -->
6507
6514
6508
6515
<dt> <a for=/>byte sequence</a>
@@ -6523,7 +6530,7 @@ steps:
6523
6530
<p> Set <var> length</var> to <span class=XXX> unclear, see
6524
6531
<a href="https://github.com/whatwg/html/issues/6424">html/6424</a> for improving this</span> .
6525
6532
6526
- <p> Set <var> Content-Type </var> to `<code> multipart/form-data; boundary=</code> `, followed by the
6533
+ <p> Set <var> type </var> to `<code> multipart/form-data; boundary=</code> `, followed by the
6527
6534
<a><code>multipart/form-data</code> boundary string</a> generated by the
6528
6535
<a><code>multipart/form-data</code> encoding algorithm</a> .
6529
6536
@@ -6533,14 +6540,14 @@ steps:
6533
6540
<a lt="urlencoded serializer"><code>application/x-www-form-urlencoded</code> serializer</a> with
6534
6541
<var> object</var> 's <a for=URLSearchParams>list</a> .
6535
6542
6536
- <p> Set <var> Content-Type </var> to
6543
+ <p> Set <var> type </var> to
6537
6544
`<code> application/x-www-form-urlencoded;charset=UTF-8</code> `.
6538
6545
6539
6546
<dt> <a for=/>scalar value string</a>
6540
6547
<dd>
6541
6548
<p> Set <var> source</var> to the <a>UTF-8 encoding</a> of <var> object</var> .
6542
6549
6543
- <p> Set <var> Content-Type </var> to `<code> text/plain;charset=UTF-8</code> `.
6550
+ <p> Set <var> type </var> to `<code> text/plain;charset=UTF-8</code> `.
6544
6551
6545
6552
<dt> {{ReadableStream}}
6546
6553
<dd>
@@ -6572,7 +6579,7 @@ steps:
6572
6579
<var> stream</var> , <a for=body>source</a> is <var> source</var> , and <a for=body>length</a> is
6573
6580
<var> length</var> .
6574
6581
6575
- <li><p> Return <var> body</var> and <var> Content-Type </var> .
6582
+ <li><p> Return ( <var> body</var> , <var> type </var> ) .
6576
6583
</ol>
6577
6584
6578
6585
@@ -7303,17 +7310,18 @@ constructor steps are:
7303
7310
<p> If <var> init</var> ["{{RequestInit/body}}"] <a for=map>exists</a> and is non-null, then:
7304
7311
7305
7312
<ol>
7306
- <li><p> Let <var> Content-Type</var> be null.
7313
+ <li><p> Let <var> bodyWithType</var> be the result of <a for=BodyInit>extracting</a>
7314
+ <var> init</var> ["{{RequestInit/body}}"] , with <a for=BodyInit/extract><var>keepalive</var></a>
7315
+ set to <var> request</var> 's <a for=request>keepalive</a> .
7307
7316
7308
- <li><p> Set <var> initBody</var> and <var> Content-Type</var> to the result of
7309
- <a for=BodyInit>extracting</a> <var> init</var> ["{{RequestInit/body}}"] , with
7310
- <a for=BodyInit/extract><var>keepalive</var></a> set to <var> request</var> 's
7311
- <a for=request>keepalive</a> .
7317
+ <li><p> Set <var> initBody</var> to <var> bodyWithType</var> 's <a for="body with type">body</a> .
7312
7318
7313
- <li><p> If <var> Content-Type</var> is non-null and <a>this</a> 's <a for=Request>headers</a>' s
7319
+ <li><p> Let <var> type</var> be <var> bodyWithType</var> 's <a for="body with type">type</a> .
7320
+
7321
+ <li><p> If <var> type</var> is non-null and <a>this</a> 's <a for=Request>headers</a>' s
7314
7322
<a for=Headers>header list</a> <a for="header list">does not contain</a>
7315
7323
`<code> Content-Type</code> `, then <a for=Headers>append</a> (`<code> Content-Type</code> `,
7316
- <var> Content-Type </var> ) to <a>this</a> 's <a for=Request>headers</a> .
7324
+ <var> type </var> ) to <a>this</a> 's <a for=Request>headers</a> .
7317
7325
</ol>
7318
7326
7319
7327
<li><p> Let <var> inputOrInitBody</var> be <var> initBody</var> if it is non-null; otherwise
@@ -7572,15 +7580,18 @@ constructor steps are:
7572
7580
<p class="note no-backref"> 101 is included in <a>null body status</a> due to its use elsewhere.
7573
7581
It does not affect this step.
7574
7582
7575
- <li><p> Let <var> Content-Type</var> be null.
7583
+ <li><p> Let <var> bodyWithType</var> be the result of <a for=BodyInit>extracting</a>
7584
+ <var> body</var> .
7585
+
7586
+ <li><p> Set <a>this</a> 's <a for=Response>response</a>' s <a for=response>body</a> to
7587
+ <var> bodyWithType</var> 's <a for="body with type">body</a> .
7576
7588
7577
- <li><p> Set <a>this</a> 's <a for=Response>response</a>' s <a for=response>body</a> and
7578
- <var> Content-Type</var> to the result of <a for=BodyInit>extracting</a> <var> body</var> .
7589
+ <li><p> Let <var> type</var> be <var> bodyWithType</var> 's <a for="body with type">type</a> .
7579
7590
7580
- <li><p> If <var> Content-Type </var> is non-null and <a>this</a> 's <a for=Response>response</a>' s
7591
+ <li><p> If <var> type </var> is non-null and <a>this</a> 's <a for=Response>response</a>' s
7581
7592
<a for=response>header list</a> <a for="header list">does not contain</a>
7582
7593
`<code> Content-Type</code> `, then <a for="header list">append</a> (`<code> Content-Type</code> `,
7583
- <var> Content-Type </var> ) to <a>this</a> 's <a for=Response>response</a>' s
7594
+ <var> type </var> ) to <a>this</a> 's <a for=Response>response</a>' s
7584
7595
<a for=response>header list</a> .
7585
7596
</ol>
7586
7597
</ol>
0 commit comments