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

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

Issue 1862293003: Fetch: Fix 'body' processing in RequestInit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 test(function() { 7 test(function() {
8 var headers = new Headers; 8 var headers = new Headers;
9 headers.set('User-Agent', 'Mozilla/5.0'); 9 headers.set('User-Agent', 'Mozilla/5.0');
10 headers.set('Accept', 'text/html'); 10 headers.set('Accept', 'text/html');
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 {method: 'POST', 741 {method: 'POST',
742 body: new Blob([''], {type: 'Text/Plain'}), 742 body: new Blob([''], {type: 'Text/Plain'}),
743 headers: [['Content-Type', 'Text/Html']]}); 743 headers: [['Content-Type', 'Text/Html']]});
744 return req.blob() 744 return req.blob()
745 .then(function(blob) { 745 .then(function(blob) {
746 assert_equals(blob.type, 'text/html'); 746 assert_equals(blob.type, 'text/html');
747 assert_equals(req.headers.get('Content-Type'), 'Text/Html'); 747 assert_equals(req.headers.get('Content-Type'), 'Text/Html');
748 }); 748 });
749 }, 'Extract a MIME type (1)'); 749 }, 'Extract a MIME type (1)');
750 750
751 promise_test(function(t) {
752 var req = new Request('http://localhost/',
753 {method: 'POST',
754 credentials: 'include',
755 body: 'this is a body'});
756
757 return req.text()
758 .then(t => {
759 assert_equals(t, 'this is a body');
760 });
761 }, 'Credentials and body can both be set.');
762
751 done(); 763 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698