Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify HeadersInit #418

Merged
merged 2 commits into from
Nov 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -4015,7 +4015,8 @@ fetch("/music/pk/altes-kamuffel.flac")

<h3 id=headers-class>Headers class</h3>

<pre class=idl>typedef (Headers or sequence&lt;sequence&lt;ByteString>> or record&lt;ByteString, ByteString>) HeadersInit;
<pre class=idl>
typedef (sequence&lt;sequence&lt;ByteString>> or record&lt;ByteString, ByteString>) HeadersInit;

[Constructor(optional HeadersInit init),
Exposed=(Window,Worker)]
Expand Down Expand Up @@ -4100,18 +4101,8 @@ run these steps:

<ol>
<li>
<p>If <var>object</var> is a {{Headers}} object, then for each <var>header</var> in its
<a for=Headers>header list</a>, retaining order,
<a for=Headers>append</a>
<var>header</var>'s <a for=header>name</a>/<var>header</var>'s <a for=header>value</a>
to <var>headers</var>. Rethrow any exception.

<p class=note>Once <code>Headers.prototype[Symbol.iterator]</code> is defined this
special casing will no longer be needed.

<li>
<p>Otherwise, if <var>object</var> is a sequence, then for each
<var>header</var> in <var>object</var>, run these substeps:
<p>If <var>object</var> is a <a>sequence</a>, then for each <var>header</var> in
<var>object</var>, run these substeps:

<ol>
<li><p>If <var>header</var> does not contain exactly two items, then <a>throw</a> a
Expand All @@ -4122,7 +4113,7 @@ run these steps:
<var>headers</var>. Rethrow any exception.
</ol>

<li><p>Otherwise, if <var>object</var> is a <a>record</a>, then for each <a for=record>mapping</a>
<li><p>Otherwise, <var>object</var> is a <a>record</a>, then for each <a for=record>mapping</a>
(<var>key</var>, <var>value</var>) in <var>object</var>, <a lt=append for=Headers>append</a>
<var>key</var>/<var>value</var> to <var>headers</var>. Rethrow any exception.
</ol>
Expand Down