[Webkit-unassigned] [Bug 183703] New: [Fetch API] Allow used body replacement in Request constructor

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Mar 16 11:03:51 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=183703

            Bug ID: 183703
           Summary: [Fetch API] Allow used body replacement in Request
                    constructor
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: HTML DOM
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: harris at cloudflare.com
                CC: cdumez at apple.com

Currently, the following code snippet replaces request's body as one would expect:

  let request = new Request(url, {
    method: "POST", body: "foo"
  })
  request = new Request(request, {
    body: "bar"
  })

But this snippet, in which the author tries to replace a used body, throws a TypeError:

  let request = new Request(url, {
    method: "POST", body: "foo"
  })
  await request.text()  // disturb the body
  request = new Request(request, {
    body: "bar"
  })  // throws

Since the second snippet is providing a new body to the constructor, there doesn't seem to be any technical need to throw.

I have a pull request in to change this in the Fetch spec here:

https://github.com/whatwg/fetch/pull/675

Accompanying WPT PR here:

https://github.com/w3c/web-platform-tests/pull/9931

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180316/c55ffb89/attachment.html>


More information about the webkit-unassigned mailing list