cloudflare · Cloudflare Workers Docs
Workers Fetch Events
How to use the dispatchFetch function in Miniflare to simulate HTTP requests, dispatch FetchEvents to a Worker, and manage upstream responses during testing.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Workers Fetch Events
How to use the dispatchFetch function in Miniflare to simulate HTTP requests, dispatch FetchEvents to a Worker, and manage upstream responses during testing.
When To Use
Use when you need to programmatically trigger HTTP fetch events and simulate request/response cycles within a Miniflare testing environment.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/workers-testing-miniflare-fetch-events-workflow-guide.md | Documentation explaining how Miniflare logs and dispatches HTTP request and response events during worker testing. | Questions about documentation explaining how Miniflare logs and dispatches HTTP request and response events during worker testing. |
examples/workers-testing-miniflare-fetch-events-cloudflare-workers-miniflare-fetc.text | A JavaScript code example demonstrating how to intercept and inspect fetch events using Miniflare in a Cloudflare Workers testing environment. | Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to intercept and inspect fetch events using Miniflare in a Cloudflare Wor... |
examples/workers-testing-miniflare-fetch-events-cloudflare-workers-miniflare-disp.text | A code example demonstrating how to use the Miniflare dispatchFetch method to simulate incoming fetch events with custom headers and CF properties. | Exact payloads, commands, or snippets shown in A code example demonstrating how to use the Miniflare dispatchFetch method to simulate incoming fetch events with cus... |
examples/workers-testing-miniflare-fetch-events-cloudflare-workers-miniflare-fetc-2.text | A JavaScript code example demonstrating how to use Miniflare to intercept and test Workers fetch events by throwing an error and using passThroughOnException. | Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to use Miniflare to intercept and test Workers fetch events by throwing a... |
What This Skill Covers
- Whenever an HTTP request is made, a Request object is dispatched to your worker, then the generated Response is returned. TheRequest object will include acf...
- Main sections:
HTTP Requests,Dispatching Events,Upstream.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://developers.cloudflare.com/workers/testing/miniflare/core/fetch
