diff --git a/fetch.bs b/fetch.bs index 81611d005..954d23090 100644 --- a/fetch.bs +++ b/fetch.bs @@ -4393,6 +4393,7 @@ typedef (Blob or BufferSource or FormData or URLSearchParams or ReadableStream o
[NoInterfaceObject,
  Exposed=(Window,Worker)]
 interface Body {
+  readonly attribute ReadableStream? body;
   readonly attribute boolean bodyUsed;
   [NewObject] Promise<ArrayBuffer> arrayBuffer();
   [NewObject] Promise<Blob> blob();
@@ -4420,6 +4421,9 @@ non-null and its stream is
 non-null and its stream is
 locked.
 
+

The body attribute's getter must return null if +body is null and body's stream otherwise. +

The bodyUsed attribute's getter must return true if disturbed, and false otherwise. @@ -4880,6 +4884,8 @@ constructor must run these steps: inputBody is non-null, and request's method is `GET` or `HEAD`, then throw a TypeError. +

  • Let body be inputBody. +

  • If init's body member is present and is non-null, run these substeps: @@ -4888,11 +4894,11 @@ constructor must run these steps:

  • Let Content-Type be null.

  • If init's keepalive member is present and is true, then set - inputBody and Content-Type to the result of + body and Content-Type to the result of extracting init's body member, with keepalive flag set. Rethrow any exceptions. -

  • Otherwise, set inputBody and Content-Type to the result of +

  • Otherwise, set body and Content-Type to the result of extracting init's body member. Rethrow any exceptions. @@ -4905,7 +4911,7 @@ constructor must run these steps:

  • -

    If inputBody is non-null and inputBody's source is +

    If body is non-null and body's source is null, then run these substeps:

      @@ -4916,49 +4922,36 @@ constructor must run these steps: use-CORS-preflight flag.
    -
  • Set r's request's - body to inputBody. -

  • Set r's MIME type to - the result of extracting a MIME type - from r's request's - header list. -

  • -

    If input is a {{Request}} object and - input's request's - body is non-null, run these substeps: +

    If inputBody is non-null, then run these substeps:

      -
    1. Let dummyStream be an empty - {{ReadableStream}} object. +

    2. +

      Let rs bs a {{ReadableStream}} object from which one can read the exactly + same data as one could read from inputBody's stream. -

    3. Set input's request's - body to a new body whose - stream is dummyStream. +

      This will be specified more precisely once + transform stream and + piping are precisely defined. + See the issue. -

    4. -

      Let reader be the result of getting a reader - from dummyStream. -

      This operation will not throw an exception. +

      This makes inputBody's stream + locked and disturbed immediately. -

    5. -

      Read all bytes from - dummyStream with reader. -

      This operation makes dummyStream disturbed. +

    6. If inputBody is body, then set body to a new + body whose stream is rs, whose source + is inputBody's source and whose total bytes is + inputBody's total bytes.

    -

    These substeps are meant to produce the observable equivalent of - "piping" input's body's - stream into r. That is, input is - left with a body with a - {{ReadableStream}} object that is - disturbed and - locked, while the data readable from - r's body's - stream is now equal to what used to be input's, - if input's original body is non-null. +

  • Set r's request's body to body. + +

  • Set r's MIME type to + the result of extracting a MIME type + from r's request's + header list.

  • Return r. @@ -5051,7 +5044,6 @@ interface Response { readonly attribute boolean ok; readonly attribute ByteString statusText; [SameObject] readonly attribute Headers headers; - readonly attribute ReadableStream? body; [SameObject] readonly attribute Promise<Headers> trailer; [NewObject] Response clone(); @@ -5232,10 +5224,6 @@ must return response's

    The headers attribute's getter must return the associated {{Headers}} object. -

    The body attribute's getter must return null if -the associated body is null and the associated -body's stream otherwise. -

    The trailer attribute's getter must return the associated trailer promise.