Re: [whatwg/fetch] Add RequestInit members to Request domintro (#620)

domenic requested changes on this pull request.

A few more tiny tweaks suggested now that I'm back from break!

> +  <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 navigating between documents.
+
+  <dt>"<code>websocket</code>"
+  <dd>This is a special mode used only when establishing a WebSocket connection.

Maybe link this to the "establish a WebSocket connection" algorithm.

> + <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 navigating between documents.

Maybe `<a lt="navigate">navigating</a>`, which should automatically link to https://html.spec.whatwg.org/#navigate

> @@ -1091,6 +1125,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>Used to follow all redirects incurred when fetching a resource.

s/Used to follow/Follow

> @@ -1091,6 +1125,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>Used to follow all redirects incurred when fetching a resource.
+
+  <dt>"<code>error</code>"
+  <dd>This mode makes fetch return a <a>network error</a> when a request is met with a redirect.

s/This mode makes fetch return/Return

> @@ -1091,6 +1125,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>Used to follow all redirects incurred when fetching a resource.
+
+  <dt>"<code>error</code>"
+  <dd>This mode makes fetch return a <a>network error</a> when a request is met with a redirect.
+
+  <dt>"<code>manual</code>"
+  <dd>This mode is used to retrieve an <a>opaque-redirect filtered response</a> when a request is

s/This mode is used to retrieve/Retrieves

> @@ -4903,8 +4951,59 @@ initially a new {{AbortSignal}} object.
  <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.
+ {{Request}} object.
+
+ <p>The optional <var>init</var> argument allows for setting properties appearing in {{RequestInit}}
+ via object members of the same name. These are the object members that can be used:</p>

I think this could be tightened up to not reference the RequestInit dictionary; now that this documentation exists, developers shouldn't need to know about it. E.g. "The optional _init_ argument is an object whose properties can be set as follows:"

> +  <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 set disassociate <var>request</var> from any {{Window}}.

s/set disassociate/disassociate

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/620#pullrequestreview-86223247

Received on Tuesday, 2 January 2018 19:39:53 UTC