Releases: mswjs/msw
Releases · mswjs/msw
v0.32.1
Bug fixes
- Fixes an issue that resulted in corrupted original response bodies if they were compressed with gzip (mswjs/interceptors#136, #822).
- Fixes an issue that resulted in a memory leak of event listeners when retrieving the
IncomingMessage
body of the original response in Node.js (mswjs/interceptors#140, #785). - Fixes an issue that resulted in the "cannot run in a non-browser environment" error when running MSW in an Electron renderer process (#661, #817, #823).
v0.32.0
Bug fixes
- Fixes the
setTimeout
issue in Socket (mswjs/interceptors#120, #812)
Internals
- Updates package dependencies.
v0.31.0
v0.30.1
v0.30.0
Features
- Supports generators as response resolvers (#720).
rest.get('/polling/:maxCount', function* (req, res, ctx) {
const { count } = req.params
let count = 0
while (count < req.params. maxCount) {
yield res(ctx.json({ count }))
}
return res(ctx.json({ done: true }))
})
- Adds the
ctx.cookie
utility to the GraphQL handlers (#763). - Adds a warning when running MSW on a page that’s outside of the worker’s scope (#787).
- The worker script (
mockServiceWorker.js
) now contains the library version number to improve its inspection and debugging across releases (#781).
Bug fixes
v0.29.0
Breaking changes
- The
onUnhandledRequest
option is set to"warn"
by default (previously”bypass"
) (#703).
Features
- Adds Fallback mode. This enables MSW in browsers that don’t support Service Worker API, or in the applications that run from a static file (#688). Fallback mode is enabled internally and is not configurable.
- Running
npx msw init
now recursively creates a non-existing worker directory (#699).
Bug fixes
- Fixes an issue that resulted in a memory leak when running multiple tests dependent on
setupServer
(mswjs/interceptors#116). - Fixes an issue that resulted in a proper XML response body not being accessible under
xhrInstance.responseXML
in Node.js (#715). - Fixes an issue when an expired response cookie persisted on a mocked response after its expiration date (#708).
- Fixes an issue that resulted in ESLint complaining about the pragma comment of the worker script (#693).
Internal
- Updates dependencies to the latest versions (#747).
v0.28.2
v0.28.1
Bug fixes
- Fixes the issue that resulted in the "Cannot read property 'id' of undefined" in iframe scenarios (#643, #645).
- Fixes the issue when making an explicit return in a handler considered the request unhandled in Node.js (#655, #672).
- Fixes the issue that resulted in a multipart form data not being parsed correctly given extra spaces or the lack of such in the
Content-Type
header (#671).
v0.28.0
Breaking changes
- The
response
instance in the life-cycle events now handlesresponse.headers
as theHeaders
instance (#660).
server.on('response:bypass', (res) => {
- res.headers['content-type']
+ res.headers.get('content-type')
})
- Calling
setupServer
no longer applies request interception immediately. Instead, it's applied when calledserver.listen()
(#660).
Bug fixes
- Fixes the order of events in the intercepted
XMLHttpRequest
in Node.js (mswjs/interceptors#102). - Fixes an issue that resulted in the "TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"" exception when using MSW with
superagent
(#632).
Internal
- Updates dependencies (@mswjs/interceptors, headers-utils).
v0.27.2
Bug fixes
- Fixes a backward-compatibility issue of the
DropFirstInTuple
type used internally incompose.ts
(#658). - Fixes an issue in IE11 when retrieving a stack trace of a handler would throw an exception (#647).
- Fixes an issue when a stream in a response body would cause a response timeout (#602).
- Fixes an issue when a cookie retrieval would cause a Fast Refresh to break in Next.js (#649).