feat(fetch): support file URLs via opt-in dispatcher interceptor#4907
Open
feat(fetch): support file URLs via opt-in dispatcher interceptor#4907
Conversation
Signed-off-by: Matteo Collina <hello@matteocollina.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4907 +/- ##
==========================================
- Coverage 92.90% 92.88% -0.02%
==========================================
Files 112 113 +1
Lines 35638 35821 +183
==========================================
+ Hits 33109 33272 +163
- Misses 2529 2549 +20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
KhafraDev
reviewed
Mar 18, 2026
| })) | ||
| } | ||
| case 'file:': { | ||
| // For now, unfortunate as it is, file URLs are left as an exercise for the reader. |
Member
There was a problem hiding this comment.
This comment comes from the spec and should be kept.
Member
Author
|
What do you think @KhafraDev, will this be a better model? |
Member
|
Yes, I have no problems with it. Is there an interest in this again, I saw my old PR getting activity too? |
Member
Author
it was marked as semver-major, and I took a look at it again before cutting undici 8. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
interceptors.file()dispatcher interceptor for handlingfile:URLsallow()callbackfetch()file scheme path to dispatcher so custom dispatchers/interceptors can handle itDetails
lib/interceptor/file.jsinterceptors.fileinindex.jstypes/interceptors.d.tsdocs/docs/api/Dispatcher.mdTests
test/interceptors/file.jstest/fetch/file-url-interceptor.jsfetch(file://...)rejectsfetch(file://...)works with custom file interceptor