Header values are not sorted and combined on iteration |
|||
Issue descriptionFetch requires [1] that "the value pairs to iterate over are the return value of running sort and combine with the header list", which is to say we don't simply iterate over the internal data of Headers but make a sorted and combined copy [2] [3]. [1] https://fetch.spec.whatwg.org/#headers-class [2] https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine [3] https://fetch.spec.whatwg.org/#concept-header-value-combined e.g. const headers = new Headers(); headers.append('b', '1'); headers.append('a', '2'); headers.append('a', '3'); const keys = [], values = []; for (let [k, v] of headers) console.log(`${k}: ${v}`); Should log: a: 2, 3 b: 1 See also: issue 645497
,
Dec 7 2016
Sorting part has been fixed by the commit in #1. Combining part still needs to be fixed. Ideally bug 645497 should also get fixed at the same time.
,
Dec 11 2016
Upload CL for this issue. (https://codereview.chromium.org/2559273005/)
,
Dec 14 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/da6e2412d9e3547954e1196c3b8d523be7090df6 commit da6e2412d9e3547954e1196c3b8d523be7090df6 Author: corona10 <corona10@gmail.com> Date: Wed Dec 14 20:47:27 2016 [Fetch API] Implement combining of Headers for same keys. Currently FetchHeaderList::sortAndCombine() only sorts the list and does not combine values for the same key. This CL implements the missing part in the function. BUG= 670439 , 667376 Review-Url: https://codereview.chromium.org/2559273005 Cr-Commit-Position: refs/heads/master@{#438615} [modify] https://crrev.com/da6e2412d9e3547954e1196c3b8d523be7090df6/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/headers.js [modify] https://crrev.com/da6e2412d9e3547954e1196c3b8d523be7090df6/third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp
,
Jun 2 2017
I've just tried the sample from the bug description and got the expected result. I guess we can close this bug?
,
Jun 2 2017
Yep! |
|||
►
Sign in to add a comment |
|||
Comment 1 by bugdroid1@chromium.org
, Dec 3 2016