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

Side by Side Diff: LayoutTests/http/tests/fetch/script-tests/request.js

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, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/modules/fetch/Request.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 if (self.importScripts) { 1 if (self.importScripts) {
2 importScripts('../resources/fetch-test-helpers.js'); 2 importScripts('../resources/fetch-test-helpers.js');
3 } 3 }
4 4
5 var URL = 'https://www.example.com/test.html'; 5 var URL = 'https://www.example.com/test.html';
6 6
7 function size(headers) { 7 function size(headers) {
8 var count = 0; 8 var count = 0;
9 for (var header of headers) { 9 for (var header of headers) {
10 ++count; 10 ++count;
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 {method: 'POST', 698 {method: 'POST',
699 body: new Blob([''], {type: 'Text/Plain'}), 699 body: new Blob([''], {type: 'Text/Plain'}),
700 headers: [['Content-Type', 'Text/Html']]}); 700 headers: [['Content-Type', 'Text/Html']]});
701 return req.blob() 701 return req.blob()
702 .then(function(blob) { 702 .then(function(blob) {
703 assert_equals(blob.type, 'text/html'); 703 assert_equals(blob.type, 'text/html');
704 assert_equals(req.headers.get('Content-Type'), 'Text/Html'); 704 assert_equals(req.headers.get('Content-Type'), 'Text/Html');
705 }); 705 });
706 }, 'Extract a MIME type (1)'); 706 }, 'Extract a MIME type (1)');
707 707
708 promise_test(function(t) {
709 var req = new Request('http://localhost/', {method: 'POST', body: 'hello'});
710 return req.text().then(function(text) {
711 assert_equals(text, 'hello');
712 var req2 = new Request(req);
713 assert_true(req.bodyUsed);
714 assert_false(req2.bodyUsed);
715 return req2.text();
716 }).then(function(text) {
717 assert_equals(text, '');
718 });
719 }, 'Consume and pass');
720
708 done(); 721 done();
OLDNEW
« no previous file with comments | « no previous file | Source/modules/fetch/Request.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698