Skip to content

fix: let interim 1xx responses through DecoratorHandler - #6028

Merged
mcollina merged 2 commits into
nodejs:mainfrom
mrityunjay-pandey:fix/decorator-handler-interim-responses
Oct 22, 2026
Merged

mcollina merged 2 commits into
nodejs:mainfrom
mrityunjay-pandey:fix/decorator-handler-interim-responses

Conversation

@mrityunjay-pandey

Copy link
Copy Markdown
Contributor

This relates to...

Fixes #6027

Rationale

The HTTP/1.1 and HTTP/2 clients deliver interim 1xx responses (e.g. 103 Early Hints) through onResponseStart before the final response. DecoratorHandler.onResponseStart asserts it is only called once, so any handler built on it (the dns interceptor's DNSDispatchHandler in the issue) fails the request with ERR_ASSERTION when the final response arrives after an interim one.

Changes

  • DecoratorHandler.onResponseStart only applies the once-only check (and sets the flag) for final responses (statusCode >= 200). Interim responses are still forwarded to the wrapped handler, which already ignores them where needed (e.g. fetch).
  • Tests: a DecoratorHandler unit test (a 103 then a 200 are both forwarded, and a second final response still asserts), and a dns interceptor test fetching from a server that sends 103 Early Hints. Both fail on main.

Features

N/A

Bug Fixes

  • Interceptors built on DecoratorHandler (such as interceptors.dns()) no longer fail when a response is preceded by a 1xx interim response.

Breaking Changes and Deprecations

N/A

Status

Tested locally on Linux with Node 24: npm run lint and npm run test:unit (1634 tests, 1629 pass, 5 skipped, 0 fail).

@codecov-commenter

codecov-commenter commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 91.59%. Comparing base (935aa75) to head (fcbf9e9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6028      +/-   ##
==========================================
+ Coverage   91.56%   91.59%   +0.02%     
==========================================
  Files         113      113              
  Lines       43938    43942       +4     
==========================================
+ Hits        40234    40248      +14     
+ Misses       3704     3694      -10     

β˜” View full report in Codecov by Harness.
πŸ“’ 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 0f6739a into nodejs:main Oct 22, 2026
38 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 5, 2026
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.

dns interceptor: fetch fails with ERR_ASSERTION when the response is preceded by 103 Early Hints

4 participants