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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response-content.js

Issue 2163273002: [Fetch] Accept URLSearchParams in Response constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 5 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
Index: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response-content.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response-content.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response-content.js
index 75727e42244d19c33d816c114b4346e33c390bba..266bf433c752e98c874a2a9244482b0419194570 100644
--- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response-content.js
+++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response-content.js
@@ -115,6 +115,23 @@ promise_test(function() {
}, 'Behavior of Response with FormData content');
promise_test(function() {
+ var urlSearchParams = new URLSearchParams();
yhirano 2016/07/21 09:00:27 I prefer const / let for new code whenever possibl
e_hakkinen 2016/07/21 12:02:25 Done.
+ urlSearchParams.append('sample string', '1234567890');
+ urlSearchParams.append('sample string 2', '1234567890 & 2');
+ var response = new Response(urlSearchParams);
+ assert_equals(
+ response.headers.get('Content-Type'),
+ 'application/x-www-form-urlencoded;charset=UTF-8',
+ 'A Response constructed with an URLSearchParams should have a Content-Type.');
tyoshino (SeeGerritForStatus) 2016/07/21 07:30:28 an URLSearchParams -> a URLSearchParams as it's pr
e_hakkinen 2016/07/21 12:02:25 Done.
+ return response.text()
+ .then(function(result) {
+ assert_equals(
+ result, 'sample+string=1234567890&sample+string+2=1234567890+%26+2',
+ 'Creating a Response with URLSearchParams body must succeed.');
+ });
+ }, 'Behavior of Response with URLSearchParams content');
+
+promise_test(function() {
var headers = new Headers;
headers.set('Content-Language', 'ja');
var response = new Response(

Powered by Google App Engine
This is Rietveld 408576698