mswjs / msw

Industry standard API mocking for JavaScript.
https://mswjs.io
MIT License
15.97k stars 519 forks source link

intercepted request won't abort on node 20 w/ msw@1.3.3 #2184

Closed gerbyzation closed 2 months ago

gerbyzation commented 5 months ago

Prerequisites

Environment check

Node.js version

v20.6.1

Reproduction repository

https://github.com/gerbyzation/msw-node20-undici-fetch-abort-repro

Reproduction steps

Setup:

git clone https://github.com/gerbyzation/msw-node20-undici-fetch-abort-repro
cd msw-node20-undici-fetch-abort-repro
pnpm i

To demonstrate the abort doesn't work with an MSW handler, but does work without run the two scripts below:

node not-working-abort.mjs
node working-abort.mjs

Current behavior

Request completes without throwing an abort error

Expected behavior

fetch should throw an abort error

kettanaito commented 2 months ago

I'm sure this is fixed in v2. I have no plans to backport it to v1. Please upgrade to v2 to get this fix. Thanks.