docs: document createFetch custom fetch option#603
Conversation
The `createFetch` function accepts a `fetch` option in `CreateFetchOptions` that allows passing a custom fetch implementation. This is useful for providing a Node.js-compatible fetch (e.g. undici), a service worker's fetch, or a test mock — but was not documented in the README. Closes unjs#533 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA new "Using a custom fetch implementation" subsection is added to ChangesCustom fetch documentation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes #533
The
createFetchfunction accepts afetchoption inCreateFetchOptionsthat lets you provide a custom fetch implementation. This is useful for Node.js-compatible fetch (e.g.undici), service worker fetch, or test mocks — but it was completely undocumented in the README.Changes
README.md: Added a new "🔧 Using a custom fetch implementation" section after "Create fetch with default options", showing how to usecreateFetch({ fetch: customImpl })with a basic example and a practicalundiciexample.Test plan
Summary by CodeRabbit
ofetchinstance.fetchfunction and usingundici’sfetchin Node.js.