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

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

Issue 1056783002: [Fetch] Request constructor 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/request.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..174fd3afb8398ad3025452492731404c14300f44 100644
--- a/Source/modules/fetch/Request.cpp
+++ b/Source/modules/fetch/Request.cpp
@@ -65,6 +65,17 @@ Request* Request::createRequestWithRequestOrString(ExecutionContext* context, Re
// |request|'s credentials mode, and cache mode is |request|'s cache mode."
FetchRequestData* request = createCopyOfFetchRequestDataForFetch(context, inputRequest ? inputRequest->request() : FetchRequestData::create());
+ if (inputRequest && inputRequest->blobDataHandle() && inputRequest->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(inputRequest->blobDataHandle()->type());
+ request->setBlobDataHandle(BlobDataHandle::create(blobData.release(), 0));
+ }
+
// "4. Let |fallbackMode| be null."
// "5. Let |fallbackCredentials| be null."
// "6. Let |fallbackCache| be null."
« no previous file with comments | « LayoutTests/http/tests/fetch/script-tests/request.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698