Allow overriding Node's internal fetch
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 880
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 68
Description
This would solve...
As Node's release cycles are significantly longer than those of undici, it would be nice to be able to benefit from new features & fixes faster.
The implementation should look like...
node -r undici/overrideGlobals index.js
and/or (as suggested by @mcollina)
undici.__overrideGlobals()
I have also considered...
Writing an additional/external npm package to do the same. This would require to maintain the version of that package in sync with undici, which migh be annoying.
Additional context
Mixing Requests from Node with Requests from undici can result in unexpected behaviors. This would mitigate that by allowing to mix those, at least for the specific version of undici that gets imported.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing how Node's internal fetch globals and the undici exports are wired, then compare the proposed node -r undici/overrideGlobals index.js preload path with undici.__overrideGlobals(). Done means providing a supported way to replace Node's fetch-related globals with the imported undici version and covering the chosen interface with tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100