OLD | NEW |
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 Loading... |
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(); |
OLD | NEW |