Skip to content

Commit 51ff50a

Browse files
authored
[web-api] Correct MIME type check. (#1537)
Fixes #1138.
1 parent 4feb919 commit 51ff50a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

document/web-api/index.bs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ url:https://fetch.spec.whatwg.org/#concept-body-consume-body;text:consume body;t
6969

7070
<pre class='link-defaults'>
7171
spec:ecma-262; type:exception; for:ECMAScript; text:TypeError
72+
spec:fetch; type:dfn; text:get
7273
spec:webidl; type:dfn; text:resolve
7374
</pre>
7475

@@ -111,8 +112,10 @@ Note: This algorithm accepts a {{Response}} object, or a
111112
1. Let |returnValue| be [=a new promise=]
112113
1. [=Upon fulfillment=] of |source| with value |unwrappedSource|:
113114
1. Let |response| be |unwrappedSource|'s [=Response/response=].
114-
1. Let |mimeType| be the result of [=extracting a MIME type=] from |response|'s [=response/header list=].
115-
1. If |mimeType| is not `` `application/wasm` ``, reject |returnValue| with a {{TypeError}} and abort these substeps.
115+
1. Let |mimeType| be the result of [=header list/getting=] `` `Content-Type` `` from |response|'s [=response/header list=].
116+
1. If |mimeType| is null, reject |returnValue| with a {{TypeError}} and abort these substeps.
117+
1. Remove all [=HTTP tab or space byte=] from the start and end of |mimeType|.
118+
1. If |mimeType| is not a [=byte-case-insensitive=] match for `` `application/wasm` ``, reject |returnValue| with a {{TypeError}} and abort these substeps.
116119

117120
Note: extra parameters are not allowed, including the empty `` `application/wasm;` ``.
118121

0 commit comments

Comments
 (0)