Consolidate the two cookie parsers `parseCookie` and `parseCookieHeader`

Đang mở
#24,501 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

@s1gr1d đang làm issue này rồi.

Từ ngày 18/9/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

javascript

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: https://github.com/getsentry/sentry-javascript/pull/24090#discussion_r4041421140 and https://github.com/getsentry/sentry-javascript/pull/24090#discussion_r4041448119.

Ngôn ngữ chính
TypeScript
Star
8.7k
Fork
1.9k
Merge trung bình
1 ngày 18 giờ
Pull request đã merge (30 ngày)
543

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của getsentry/sentry-javascript

Tất cả issue của getsentry/sentry-javascript

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.