parseCookie (used by filterCookies for event cookie records) and parseCookieHeader (used by httpHeadersToSpanAttributes for span attributes) have several differences:
- Nameless segments:
filterCookies('opaque-blob; theme=dark', true) returns {theme: 'dark'} and drops the blob silently. The span attribute shows ['[Filtered]', 'theme=dark'].
Set-Cookie attributes: filterCookies('sid=1; Max-Age=3600; Path=/', true) returns {sid: '[Filtered]', 'Max-Age': '3600', Path: '/'}. Max-Age and Path are metadata, not cookies. parseCookieHeader strips them.
- Only
parseCookie URL-decodes values and strips quotes.
One parser returning ordered [name, value][] pairs, with a Set-Cookie mode, could work at both call sites. filterCookies.test.ts has two it.fails tests pinning the intended Set-Cookie behavior -> those need to be flipped when fixed.
Out of the #24090 review: #24090 (comment) and #24090 (comment).
parseCookie(used byfilterCookiesfor event cookie records) andparseCookieHeader(used byhttpHeadersToSpanAttributesfor span attributes) have several differences:filterCookies('opaque-blob; theme=dark', true)returns{theme: 'dark'}and drops the blob silently. The span attribute shows['[Filtered]', 'theme=dark'].Set-Cookieattributes:filterCookies('sid=1; Max-Age=3600; Path=/', true)returns{sid: '[Filtered]', 'Max-Age': '3600', Path: '/'}.Max-AgeandPathare metadata, not cookies.parseCookieHeaderstrips them.parseCookieURL-decodes values and strips quotes.One parser returning ordered
[name, value][]pairs, with aSet-Cookiemode, could work at both call sites.filterCookies.test.tshas twoit.failstests pinning the intendedSet-Cookiebehavior -> those need to be flipped when fixed.Out of the #24090 review: #24090 (comment) and #24090 (comment).