Prompt Buddy logoPrompt Buddy

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.

Import to Prompt Buddy

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

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/workers-testing-miniflare-fetch-events-workflow-guide.mdDocumentation 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.textA 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.textA 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.textA 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

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. 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