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

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

Issue 882383002: [Fetch] Request with GET/HEAD method cannot have body (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | LayoutTests/http/tests/serviceworker/cache-add-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/fetch/script-tests/request.js
diff --git a/LayoutTests/http/tests/fetch/script-tests/request.js b/LayoutTests/http/tests/fetch/script-tests/request.js
index 9be837f8afe11800549a8f6e862972d3196bfc08..14364fe0710462198ab0fb185fd7576ac0750d88 100644
--- a/LayoutTests/http/tests/fetch/script-tests/request.js
+++ b/LayoutTests/http/tests/fetch/script-tests/request.js
@@ -384,11 +384,31 @@ test(function() {
},
'Request construction behavior regarding "used" body flag and exceptions.');
+
+// Spec: https://fetch.spec.whatwg.org/#dom-request
+// Step 21:
+// If request's method is `GET` or `HEAD`, throw a TypeError.
+promise_test(function() {
+ var headers = new Headers;
+ headers.set('Content-Language', 'ja');
+ ['GET', 'HEAD'].forEach(function(method) {
+ assert_throws(
+ {name: 'TypeError'},
+ function() {
+ new Request(URL,
+ {method: method,
+ body: new Blob(['Test Blob'], {type: 'test/type'})
+ });
+ },
+ 'Request of GET/HEAD method cannot have RequestInit body.');
+ });
+ }, 'Request of GET/HEAD method cannot have RequestInit body.');
+
promise_test(function() {
var headers = new Headers;
headers.set('Content-Language', 'ja');
var req = new Request(URL, {
- method: 'GET',
+ method: 'POST',
headers: headers,
body: new Blob(['Test Blob'], {type: 'test/type'})
});
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/cache-add-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698