Skip to content

Releases: mswjs/msw

v0.13.0

18 Apr 10:16
Compare
Choose a tag to compare

This release introduces changes to mockServiceWorker.js file. Upon updating, you will be asked to update your Service Worker file. Please follow the instructions in the browser’s console to update the file.

Features

  • Logs matched requests into browser’s console. Inspect what requests have been mocked, their handler, and the response.
  • Adds support for mocking cookies via ctx.cookie() (#101, #103).
rest.post('/login', (req, res, ctx) => {
  return res(
    ctx.cookie('auth-token', 'abc-123')
  )
})

Bug fixes

  • Prevents Service Worker to persist between different projects on the same host (#96, #99).
  • Prevents Service Worker from bypassing requests after hard reload of the page (#98, #99).

v0.12.0

01 Apr 15:37
Compare
Choose a tag to compare

This change would bump the integrity of the Service Worker. Please follow the instructions in the respective error message in your browser's console to update the Service Worker file.

Features

  • The library now handles exceptions from request handlers as 500 responses (#80, #91)

Internal

  • Updates the library's dependencies (#92)

v0.11.5

31 Mar 14:40
Compare
Choose a tag to compare

This release introduces changes to the mockServiceWorker.js file. You will be advised to update that file in your application. Please follow the instructions in the related error message in your browser's console.

Bug fixes

  • Fixes an issue when the Promise returned from calling the start() function would resolve sooner than the Service Worker enabled the mocking (#73, #90)

v0.11.4

29 Mar 10:01
Compare
Choose a tag to compare

This release introduces changes to the mockServiceWorker.js file. You will be advised to update that file in your application. Please follow the instructions in the related error message in your browser's console.

Bug fixes

  • Fixes the Response patching scenario when performing an original POST request performed a GET request instead (#77, #84)

v0.11.3

29 Mar 09:51
Compare
Choose a tag to compare

Changes

  • Failed integrity assertions now leave the mocking enabled for the purpose of better developer experience (#87). It's still highly recommended to update your Service Worker in that case, but for the sake of backwards-compatible changes it's not mandatory.

v0.11.0

27 Mar 09:24
Compare
Choose a tag to compare

Features

  • The library now runs an integrity check against the Service Worker registered in your application (#81). This is necessary to warn you when the Service Worker must be updated according to the latest published release of the library. Please follow the update instructions when such occur in your browser's console.

0.9.0

19 Mar 15:55
Compare
Choose a tag to compare

Features

  • Added support for Response patching
  • Mocked req object now contains new properties: integrity, destination, keepalive, bodyUsed

Bug fixes

  • Fixed an issue that resulted into req.params being null, causing an exception when trying to access an existing parameter

v0.8.2

13 Mar 22:25
Compare
Choose a tag to compare

Features

  • Running start() and stop() functions now returns a Promise that corresponds to the Service Worker registration/unregistration status
import { composeMocks, rest } from 'msw'

const { start, stop } = composeMocks(
  rest.get(...)
)

start.then(() => {/* Your logic here */})
stop.then(() => {/* Your logic here */})

v0.8.1

13 Mar 07:33
Compare
Choose a tag to compare

Fixes

  • Demands a command to be run with npx msw (#61)
  • Improves CLI output when run npx msw init command (#61): outputs the link to the docs

v0.8.0

11 Mar 18:05
Compare
Choose a tag to compare

Features

  • Request URI matching now ignores trailing slashes (#57, #62)