WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
183703
[Fetch API] Allow used body replacement in Request constructor
https://bugs.webkit.org/show_bug.cgi?id=183703
Summary
[Fetch API] Allow used body replacement in Request constructor
Harris Hancock
Reported
2018-03-16 11:03:51 PDT
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
Attachments
Patch
(4.06 KB, patch)
2019-03-29 16:30 PDT
,
Chris Dumez
youennf
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2019-03-29 10:26:43 PDT
<
rdar://problem/49425609
>
Chris Dumez
Comment 2
2019-03-29 16:30:04 PDT
Created
attachment 366323
[details]
Patch
Chris Dumez
Comment 3
2019-04-02 11:39:02 PDT
ping review?
youenn fablet
Comment 4
2019-04-02 12:33:30 PDT
Comment on
attachment 366323
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=366323&action=review
> Source/WebCore/Modules/fetch/FetchRequest.cpp:241 > + return Exception {TypeError, "Request input is disturbed or locked."_s };
s/{T/{ T/
Chris Dumez
Comment 5
2019-04-02 13:48:26 PDT
Committed
r243757
: <
https://trac.webkit.org/changeset/243757
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug