Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1575)

Unified Diff: Source/modules/fetch/Request.cpp

Issue 1056813002: [Fetch] Request.clone() should reflect body consumption. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@body-used
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/http/tests/fetch/script-tests/response.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/fetch/Request.cpp
diff --git a/Source/modules/fetch/Request.cpp b/Source/modules/fetch/Request.cpp
index 9d58ec8a8ad4d3c3babbf26e690863c707aee1b7..ae64c155a42a0b4aa2100ef9769662457d1b3ab6 100644
--- a/Source/modules/fetch/Request.cpp
+++ b/Source/modules/fetch/Request.cpp
@@ -337,6 +337,17 @@ Request* Request::clone(ExceptionState& exceptionState) const
}
FetchRequestData* request = m_request->clone();
+ if (blobDataHandle() && isBodyConsumed()) {
+ // Currently the only methods that can consume body data without
+ // setting 'body passed' flag consume entire body (e.g. text()). Thus
+ // we can set an empty blob to the new request instead of creating a
+ // draining stream.
+ // TODO(yhirano): Fix this once Request.body is introduced.
+ OwnPtr<BlobData> blobData = BlobData::create();
+ blobData->setContentType(blobDataHandle()->type());
+ request->setBlobDataHandle(BlobDataHandle::create(blobData.release(), 0));
+ }
+
Headers* headers = Headers::create(request->headerList());
headers->setGuard(m_headers->guard());
Request* r = new Request(executionContext(), request, headers);
« no previous file with comments | « LayoutTests/http/tests/fetch/script-tests/response.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698