Skip to content

Conversation

@mcollina
Copy link
Member

Summary

  • Fixes the new interceptor API (onResponseStart) to decode HTTP headers as latin1 instead of UTF-8
  • Per HTTP spec, header values are byte strings that should be decoded using isomorphic decode (latin1)
  • Removes the content-disposition workaround that was needed when headers were inconsistently decoded (see http: unify header treatment node#46528)

Test plan

  • Added unit tests for latin1 decoding in parseHeaders and parseRawHeaders
  • Verified existing "Receiving non-Latin1 headers" test still passes
  • All unit tests pass (npm run test:unit)
  • Linting passes

Fixes #4753

Per HTTP spec, header values are byte strings that should be decoded
using isomorphic decode (latin1), not UTF-8. The new interceptor API
(onResponseStart) was incorrectly using UTF-8.

This change:
- Updates parseHeaders and parseRawHeaders to use latin1 encoding
- Removes the content-disposition workaround that was needed when
  headers were inconsistently decoded (see nodejs/node#46528)
- Adds tests to verify latin1 decoding behavior

Fixes #4753
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.26%. Comparing base (e2aeb52) to head (143550b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4768      +/-   ##
==========================================
- Coverage   93.26%   93.26%   -0.01%     
==========================================
  Files         109      109              
  Lines       34029    34007      -22     
==========================================
- Hits        31738    31715      -23     
- Misses       2291     2292       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mcollina mcollina merged commit 9f5466c into main Jan 25, 2026
35 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New interceptor API incorrectly decodes headers as utf-8, not byte strings

4 participants