Skip to content

fix: propagate dispatcher origin to composed interceptors - #5624

Open
jibin7jose wants to merge 3 commits into
nodejs:mainfrom
jibin7jose:fix/interceptor-origin-propagation
Open

fix: propagate dispatcher origin to composed interceptors#5624
jibin7jose wants to merge 3 commits into
nodejs:mainfrom
jibin7jose:fix/interceptor-origin-propagation

Conversation

@jibin7jose

Copy link
Copy Markdown

Summary
This change ensures that composed interceptors receive the dispatcher origin automatically when a Client or Pool dispatches a request without an explicit origin in the request options.

What changed
Propagate the dispatcher’s base origin into request options before interceptor dispatch.
Preserve existing behavior for requests that already specify an origin.
Update interceptor regression tests to cover Client and Pool requests without an explicit origin.
Why
Some interceptors depend on opts.origin being present. Without this propagation, requests dispatched through a composed Client or Pool could bypass interceptor behavior unexpectedly.

Testing
Verified the interceptor test suite with:
npm run test:interceptors
Co-authored-by: [jibinjose884@gmail.com]

Co-authored-by: jibinjose884@gmail.com
@mcollina
mcollina requested review from Uzlopak, metcoder95 and ronag July 30, 2026 13:58

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Comment thread lib/dispatcher/dispatcher.js
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.53%. Comparing base (f6bfa14) to head (9272d07).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5624      +/-   ##
==========================================
+ Coverage   93.50%   93.53%   +0.02%     
==========================================
  Files         110      110              
  Lines       38451    38460       +9     
==========================================
+ Hits        35955    35974      +19     
+ Misses       2496     2486      -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.

@jibin7jose
jibin7jose requested a review from mcollina July 30, 2026 14:58
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.

4 participants