Re: [whatwg/fetch] Introduce RequestInit.duplex (PR #1457)

@annevk commented on this pull request.

Thanks, this looks good to me, but we can simplify it a bit further.

I like that we have a note about specifying "full" though. Let's keep that.

> @@ -6784,6 +6784,7 @@ dictionary RequestInit {
   DOMString integrity;
   boolean keepalive;
   AbortSignal? signal;
+  RequestDuplex? duplex;

There's no need for this to be nullable.

> @@ -6792,6 +6793,7 @@ enum RequestMode { "navigate", "same-origin", "no-cors", "cors" };
 enum RequestCredentials { "omit", "same-origin", "include" };
 enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };
 enum RequestRedirect { "follow", "error", "manual" };
+enum RequestDuplex { "half", "full" };

We don't need to have "full" here at this point.

> @@ -6880,7 +6882,15 @@ object), initially null.
 
    <dt>{{RequestInit/window}}
    <dd>Can only be null. Used to disassociate <var>request</var> from any {{Window}}.
-  </dl>
+
+   <dt>{{RequestInit/duplex}}
+   <dd>"half" for initiating a half-duplex (i.e., the user agent send all the request content
+   before starting receiving the response) fetch, and "full" for initiating a full-duplex (i.e.,
+   the user agent starts receiving the response before sending all the request content) fetch.
+   This needs to be set when {{RequestInit/body}} is a {{ReadableStream}}. <span class=note>The
+   semantics for "full" have not been specified yet. See
+   <a href="https://github.com/whatwg/fetch/issues/1254">issue #1254</a>.</span>

Use `"<code>half</code>"` for formatting. As we don't specify "full" at this point this text needs to be changed a little bit.

> @@ -7305,11 +7315,16 @@ constructor steps are:
  <li><p>Let <var>inputOrInitBody</var> be <var>initBody</var> if it is non-null; otherwise
  <var>inputBody</var>.
 
+ <li><p>If <var>init</var>["{{RequestInit/duplex}}"] is "full", then throw a {{TypeError}}.

This will happen automatically as any unknown value ends up throwing so we can remove this step.

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

Message ID: <whatwg/fetch/pull/1457/review/1021253738@github.com>

Received on Tuesday, 28 June 2022 07:39:56 UTC