| 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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 body: new Blob([''], {type: 'Text/Plain'})}); | 682 body: new Blob([''], {type: 'Text/Plain'})}); |
| 683 req.headers.set('Content-Type', 'Text/Html'); | 683 req.headers.set('Content-Type', 'Text/Html'); |
| 684 return req.blob() | 684 return req.blob() |
| 685 .then(function(blob) { | 685 .then(function(blob) { |
| 686 assert_equals(blob.type, 'text/plain'); | 686 assert_equals(blob.type, 'text/plain'); |
| 687 assert_equals(req.headers.get('Content-Type'), 'Text/Html'); | 687 assert_equals(req.headers.get('Content-Type'), 'Text/Html'); |
| 688 }); | 688 }); |
| 689 }, | 689 }, |
| 690 'MIME type unchanged if headers are modified after Request() constructor'); | 690 'MIME type unchanged if headers are modified after Request() constructor'); |
| 691 | 691 |
| 692 // The following two tests follow different code paths in Body::readAsync(). | |
| 693 promise_test(function(t) { | 692 promise_test(function(t) { |
| 694 var req = new Request('http://localhost/', | 693 var req = new Request('http://localhost/', |
| 695 {method: 'POST', | 694 {method: 'POST', |
| 696 body: new Blob([''], {type: 'Text/Plain'}), | 695 body: new Blob([''], {type: 'Text/Plain'}), |
| 697 headers: [['Content-Type', 'Text/Html']]}); | 696 headers: [['Content-Type', 'Text/Html']]}); |
| 698 return req.blob() | 697 return req.blob() |
| 699 .then(function(blob) { | 698 .then(function(blob) { |
| 700 assert_equals(blob.type, 'text/html'); | 699 assert_equals(blob.type, 'text/html'); |
| 701 assert_equals(req.headers.get('Content-Type'), 'Text/Html'); | 700 assert_equals(req.headers.get('Content-Type'), 'Text/Html'); |
| 702 }); | 701 }); |
| 703 }, 'Extract a MIME type (1)'); | 702 }, 'Extract a MIME type (1)'); |
| 704 | 703 |
| 705 promise_test(function(t) { | |
| 706 var req = new Request('http://localhost/', | |
| 707 {method: 'POST', | |
| 708 body: new Blob([''], {type: 'Text/Plain'}), | |
| 709 headers: [['Content-Type', 'Text/Html']]}); | |
| 710 req.body.cancel(); | |
| 711 return req.blob() | |
| 712 .then(function(blob) { | |
| 713 assert_equals(blob.type, 'text/html'); | |
| 714 assert_equals(req.headers.get('Content-Type'), 'Text/Html'); | |
| 715 }); | |
| 716 }, 'Extract a MIME type (2)'); | |
| 717 | |
| 718 done(); | 704 done(); |
| OLD | NEW |