cloudflare / miniflare

🔥 Fully-local simulator for Cloudflare Workers. For the latest version, see https://github.com/cloudflare/workers-sdk/tree/main/packages/miniflare.
https://miniflare.dev
MIT License
3.78k stars 205 forks source link

[Miniflare 2] Fix body.cancel() throwing undefined #757

Closed jahands closed 9 months ago

jahands commented 9 months ago

We noticed while writing a test for code that uses the Cache API that body.cancel() existed, but threw an error complaining that the underlying reader was undefined.

This ensures that reader is set before calling cancel(). I have included a test which failed before but works after the change.

changeset-bot[bot] commented 9 months ago

⚠️ No Changeset found

Latest commit: 828125c1d397535342e23b32f3cf517c4cbc5793

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

[Click here if you're a maintainer who wants to add a changeset to this PR](https://github.com/jahands/miniflare/new/fix-body-cancel?filename=.changeset/breezy-cups-lick.md&value=---%0A%22%40miniflare%2Fcore%22%3A%20patch%0A---%0A%0A%5BMiniflare%202%5D%20Fix%20body.cancel()%20throwing%20undefined%0A)

mrbbot commented 9 months ago

Thanks for fixing this! 🎉