Permalink
Browse files

Add RequestInit members to Request's domintro

Helps with #543.
  • Loading branch information...
domfarolino authored and annevk committed Jan 13, 2018
1 parent 548bca2 commit 9862bc5923c32b070486f27a22a0c3d8a61cb5d0
Showing with 119 additions and 24 deletions.
  1. +119 −24 fetch.bs
View
143 fetch.bs
@@ -759,7 +759,7 @@ is "<code>all</code>" or "<code>none</code>". Unless stated otherwise it is "<co
<dt>"<code>none</code>"
<dd>No service workers will get events for this fetch.
</dd>
</dl>
</div>
<p>A <a for=/>request</a> has an associated
@@ -989,11 +989,32 @@ unset.
"<code>navigate</code>", or "<code>websocket</code>". Unless stated otherwise, it is
"<code>no-cors</code>".
<p class="note no-backref">Even though the default <a for=/>request</a>
<a for=request>mode</a> is "<code>no-cors</code>", standards are highly
discouraged from using it for new features. It is rather unsafe. "<code>navigate</code>" and
"<code>websocket</code>" are special values for the HTML Standard.
[[!HTML]]
<div class="note no-backref">
<dl>
<dt>"<code>same-origin</code>"
<dd>Used to ensure requests are made to same-origin URLs. <a for=/>Fetch</a> will return a
<a>network error</a> if the request is not made to a same-origin URL.
<dt>"<code>cors</code>"
<dd>Makes the request a <a>CORS request</a>. Fetch will return a <a>network error</a> if the
requested resource does not understand the <a>CORS protocol</a>.
<dt>"<code>no-cors</code>"
<dd>Restricts requests to using <a>CORS-safelisted methods</a> and
<a>CORS-safelisted request-headers</a>. Upon success, fetch will return an
<a>opaque filtered response</a>.
<dt>"<code>navigate</code>"
<dd>This is a special mode used only when <a>navigating</a> between documents.
<dt>"<code>websocket</code>"
<dd>This is a special mode used only when <a lt="establish a WebSocket connection">establishing
a WebSocket connection</a>.
</dl>
<p>Even though the default <a for=/>request</a> <a for=request>mode</a> is "<code>no-cors</code>",
standards are highly discouraged from using it for new features. It is rather unsafe.
</div>
<p>A <a for=/>request</a> has an associated
<dfn id=use-cors-preflight-flag export for=request>use-CORS-preflight flag</dfn>. Unless stated
@@ -1009,14 +1030,24 @@ one or more event listeners are registered on an {{XMLHttpRequestUpload}} object
which is "<code>omit</code>", "<code>same-origin</code>", or
"<code>include</code>". Unless stated otherwise, it is "<code>omit</code>".
<p class="note no-backref"><a for=/>Request</a>'s
<a for=request>credentials mode</a> controls the flow of
<a for=/>credentials</a> during a <a for=/>fetch</a>. When
<a for=/>request</a>'s <a for=request>mode</a> is
"<code>navigate</code>", its
<a for=request>credentials mode</a> is assumed to be
"<code>include</code>" and <a for=/>fetch</a> does not currently account
for other values. If <cite>HTML</cite> changes here, this standard will need corresponding changes.
<div class="note no-backref">
<dl>
<dt>"<code>omit</code>"
<dd>Excludes credentials from this request.
<dt>"<code>same-origin</code>"
<dd>Include credentials with requests made to same-origin URLs.
<dt>"<code>include</code>"
<dd>Always includes credentials with this request.
</dl>
<p><a for=/>Request</a>'s <a for=request>credentials mode</a> controls the flow of
<a for=/>credentials</a> during a <a for=/>fetch</a>. When <a for=/>request</a>'s
<a for=request>mode</a> is "<code>navigate</code>", its <a for=request>credentials mode</a> is
assumed to be "<code>include</code>" and <a for=/>fetch</a> does not currently account for other
values. If <cite>HTML</cite> changes here, this standard will need corresponding changes.
</div>
<p>A <a for=/>request</a> has an associated
<dfn export for=request id=concept-request-use-url-credentials-flag>use-URL-credentials flag</dfn>.
@@ -1079,6 +1110,20 @@ Unless stated otherwise, it is unset.
"<code>follow</code>", "<code>error</code>", or "<code>manual</code>".
Unless stated otherwise, it is "<code>follow</code>".
<div class="note no-backref">
<dl>
<dt>"<code>follow</code>"
<dd>Follow all redirects incurred when fetching a resource.
<dt>"<code>error</code>"
<dd>Return a <a>network error</a> when a request is met with a redirect.
<dt>"<code>manual</code>"
<dd>Retrieves an <a>opaque-redirect filtered response</a> when a request is met with a redirect so
that the redirect can be followed manually.
</dl>
</div>
<p>A <a for=/>request</a> has associated
<dfn export for=request id=concept-request-integrity-metadata>integrity metadata</dfn>
(a string). Unless stated otherwise, it is the empty string.
@@ -4890,10 +4935,60 @@ initially a new {{AbortSignal}} object.
<dl class=domintro>
<dt><code><var>request</var> = new <a constructor lt="Request()">Request</a>(<var>input</var> [,
<var>init</var>])</code>
<dd>Returns a new <var>request</var> whose {{Request/url}} property is <var>input</var> if
<var>input</var> is a string, and <var>input</var>'s {{Request/url}} if <var>input</var> is a
{{Request}} object. The optional <var>init</var> argument allows for setting attributes
appearing in {{RequestInit}} via object members of the same name.
<dd>
<p>Returns a new <var>request</var> whose {{Request/url}} property is <var>input</var> if
<var>input</var> is a string, and <var>input</var>'s {{Request/url}} if <var>input</var> is a
{{Request}} object.
<p>The optional <var>init</var> argument is an object whose properties can be set as follows:</p>
<dl>
<dt>{{RequestInit/method}}
<dd>A string to set <var>request</var>'s {{Request/method}}.
<dt>{{RequestInit/headers}}
<dd>A {{Headers}} object, an object literal, or an array of two-item arrays to set
<var>request</var>'s {{Request/headers}}.
<dt>{{RequestInit/body}}
<dd>A {{BodyInit}} object or null to set <var>request</var>'s <a for=request>body</a>.
<dt>{{RequestInit/referrer}}
<dd>A string whose value is a same-origin URL, "<code>about:client</code>", or the empty string,
to set <var>request</var>'s <a>referrer</a>.
<dt>{{RequestInit/referrerPolicy}}
<dd>A <a for=/>referrer policy</a> to set <var>request</var>'s {{Request/referrerPolicy}}.
<dt>{{RequestInit/mode}}
<dd>A string to indicate whether the request will use CORS, or will be restricted to same-origin
URLs. Sets <var>request</var>'s {{Request/mode}}.
<dt>{{RequestInit/credentials}}
<dd>A string indicating whether credentials will be sent with the request always, never, or only
when sent to a same-origin URL. Sets <var>request</var>'s {{Request/credentials}}.
<dt>{{RequestInit/cache}}
<dd>A string indicating how the request will interact with the browser's cache to set
<var>request</var>'s {{Request/cache}}.
<dt>{{RequestInit/redirect}}
<dd>A string indicating whether or not <var>request</var> should automatically follow redirects,
result in an error, or manually follow redirects. Sets <var>request</var>'s {{Request/redirect}}.
<dt>{{RequestInit/integrity}}
<dd>A cryptographic hash of the resource to be fetched by <var>request</var>. Sets
<var>request</var>'s {{Request/integrity}}.
<dt>{{RequestInit/keepalive}}
<dd>A boolean to set <var>request</var>'s {{Request/keepalive}}.
<dt>{{RequestInit/signal}}
<dd>An {{AbortSignal}} to set <var>request</var>'s {{Request/signal}}.
<dt>{{RequestInit/window}}
<dd>Can only be null. Used to disassociate <var>request</var> from any {{Window}}.
</dl>
<dt><code><var>request</var> . <a attribute for=Request>method</a></code>
<dd>Returns <var>request</var>'s HTTP method, which is "<code>GET</code>" by default.
@@ -4921,13 +5016,13 @@ initially a new {{AbortSignal}} object.
fetching to compute the value of the <var>request</var>'s referrer.
<dt><code><var>request</var> . <a attribute for=Request>mode</a></code>
<dd>Returns the <a>mode</a> associated with <var>request</var>, which is a string indicating whether
or not the request will use CORS, or will be restricted to same-origin URLs.
<dd>Returns the <a>mode</a> associated with <var>request</var>, which is a string indicating
whether the request will use CORS, or will be restricted to same-origin URLs.
<dt><code><var>request</var> . <a attribute for=Request>credentials</a></code>
<dd>Returns the <a>credentials mode</a> associated with <var>request</var>, which is a string
indicating whether or not credentials will be sent with the request always, never, or only when
sent to a same-origin URL.
indicating whether credentials will be sent with the request always, never, or only when sent to a
same-origin URL.
<dt><code><var>request</var> . <a attribute for=Request>cache</a></code>
<dd>Returns the <a>cache mode</a> associated with <var>request</var>, which is a string indicating
@@ -4939,8 +5034,8 @@ initially a new {{AbortSignal}} object.
will follow redirects by default.
<dt><code><var>request</var> . <a attribute for=Request>integrity</a></code>
<dd>Returns <var>request</var>'s subresource integrity metadata, which is a cryptographic hash of the
resource being fetched. Its value may consist of multiple hashes separated by whitespace.
<dd>Returns <var>request</var>'s subresource integrity metadata, which is a cryptographic hash of
the resource being fetched. Its value may consist of multiple hashes separated by whitespace.
[[SRI]]
<dt><code><var>request</var> . <a attribute for=Request>keepalive</a></code>

0 comments on commit 9862bc5

Please sign in to comment.