Skip to content

docs: clarify fetch class compatibility#5549

Open
vibhor-aggr wants to merge 1 commit into
nodejs:mainfrom
vibhor-aggr:docs/fetch-class-compatibility
Open

docs: clarify fetch class compatibility#5549
vibhor-aggr wants to merge 1 commit into
nodejs:mainfrom
vibhor-aggr:docs/fetch-class-compatibility

Conversation

@vibhor-aggr

Copy link
Copy Markdown
Contributor

Fixes #3071.

This documents the supported pattern for fetch-related classes when Node.js' built-in Undici implementation and an installed undici package are both present.

The change clarifies that fetch, Request, Response, Headers, and FormData values should come from the same implementation:

  • all Node.js built-in globals,
  • all direct imports from the same installed undici package, or
  • globals replaced together by undici.install().

It also calls out the specific failure mode from the issue: a Request created by Node.js' built-in global Request is not guaranteed to work with fetch imported from a different undici package version, and the reverse is unsupported too.

Validation:

  • git diff --check
  • npm run lint
  • npm run test:typescript

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.44%. Comparing base (ecf714f) to head (4aacff7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5549   +/-   ##
=======================================
  Coverage   93.44%   93.44%           
=======================================
  Files         110      110           
  Lines       37418    37418           
=======================================
  Hits        34967    34967           
  Misses       2451     2451           

☔ 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.

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.

Support interoperability with other version of itself

3 participants