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

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

Issue 2559273005: [Fetch API] Implement combining of Headers with same keys. (Closed)
Patch Set: ', ' to ',' Created 4 years 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 test(function() { 5 test(function() {
6 var expectedValueMap = { 6 var expectedValueMap = {
7 'content-language': 'ja', 7 'content-language': 'ja',
8 'content-type': 'text/html; charset=UTF-8', 8 'content-type': 'text/html; charset=UTF-8',
9 'x-fetch-test': 'response test field' 9 'x-fetch-test': 'response test field'
10 }; 10 };
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 headers.delete('a'); 245 headers.delete('a');
246 headers.set('d', '4'); 246 headers.set('d', '4');
247 247
248 const keys = []; 248 const keys = [];
249 for (let [key, value] of iterator) 249 for (let [key, value] of iterator)
250 keys.push(key); 250 keys.push(key);
251 assert_array_equals(keys, ['a', 'b', 'c'], 251 assert_array_equals(keys, ['a', 'b', 'c'],
252 'The pairs to iterate over should be the return ' + 252 'The pairs to iterate over should be the return ' +
253 'value of an algorithm that implicitly makes a copy.'); 253 'value of an algorithm that implicitly makes a copy.');
254 }, 'Iteration mutation'); 254 }, 'Iteration mutation');
jsbell 2016/12/12 16:54:50 Can you add value mutations to this test?
255 255
256 test(function(t) {
257 const headers = new Headers();
258 headers.append('b', '1');
259 headers.append('b', '2');
260 headers.append('a', '4');
261 headers.append('a', '2');
262 headers.append('a', '3');
263 const keys = [], values = [];
264 for (let [k, v] of headers){
265 keys.push(k);
266 values.push(v);
267 }
268 assert_array_equals(keys, ['a', 'b'],
269 'The pairs to iterate over should be the return ' +
270 'value of an algorithm that implicitly makes a copy.');
271 assert_array_equals(values, ['2,3,4', '1,2'],
272 'The values should be sorted.');
jsbell 2016/12/12 16:54:50 The spec does not indicate that values should be s
273 },'Sorted and combined on iteration');
jsbell 2016/12/12 16:54:50 nit: space after comma
274
256 done(); 275 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698