Skip to content

Releases: mswjs/msw

v0.32.1

20 Jul 14:13
Compare
Choose a tag to compare

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

13 Jul 22:20
Compare
Choose a tag to compare

Bug fixes

Internals

  • Updates package dependencies.

v0.31.0

09 Jul 14:40
Compare
Choose a tag to compare

Bug fixes

  • Fixes the operability issue when used in React Native (#622, #808, #809, #810).

v0.30.1

01 Jul 12:50
Compare
Choose a tag to compare

Bug fixes

  • Fixes an issue when the original HTTPS requests were not correctly performed in Node.js (#700, #797).

v0.30.0

24 Jun 10:58
Compare
Choose a tag to compare

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

  • Fixes various issues to ensure Jest 27 compatibility.
  • Fixes an issue that prevented the assignment of more narrow response types (#735).
  • Fixes an issue when parsing a GraphQL-compatible REST API request produced a parsing error during the onUnhandledRequest default behavior (#740).

v0.29.0

23 May 10:05
Compare
Choose a tag to compare

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

21 Apr 12:00
Compare
Choose a tag to compare

Bug fixes

  • Fixes an issue when req.params was undefined in case when request path had no parameters present (#682, #684). The req.params value is always an object, regardless if you have path parameters defined.

v0.28.1

01 Apr 23:29
Compare
Choose a tag to compare

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

25 Mar 09:40
Compare
Choose a tag to compare

Breaking changes

  • The response instance in the life-cycle events now handles response.headers as the Headers 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 called server.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

23 Mar 15:20
Compare
Choose a tag to compare

Bug fixes

  • Fixes a backward-compatibility issue of the DropFirstInTuple type used internally in compose.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).