-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use miniflare.dispatchFetch in place of worker.fetch
#11137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 9077c9e The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
0b59ade to
be441f1
Compare
| override async unstable_canFetch(request: Request) { | ||
| // the 'sec-fetch-mode: navigate' header is stripped by something on its way into this worker | ||
| // so we restore it from 'x-mf-sec-fetch-mode' | ||
| const secFetchMode = request.headers.get("X-Mf-Sec-Fetch-Mode"); | ||
|
|
||
| if (secFetchMode) { | ||
| request.headers.set("Sec-Fetch-Mode", secFetchMode); | ||
| } | ||
|
|
||
| return await super.unstable_canFetch(request); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer needed because it's handled in Miniflare.
|
Can we also remove the custom cdn-cgi triggers handling? |
We can remove the extra plugin and put the trigger handling in the |
be441f1 to
06640fa
Compare
06640fa to
9077c9e
Compare
Fixes #000.
Switch all instances of
miniflare.getWorker()followed byworker.fetch()to useminiflare.dispatchFetch(). This means that the Vite plugin now emulates Cloudflare's response encoding in the same way as Wrangler.