msw
3.0.7 · 18 Nov 2026MIT36.1M / weekRepositoryHomepagenpmAtom feed
0.49.3 is the newest release of 0.44.x.
In short
3 breaking1 deprecated1 new5 changed
- Breaking
req.destinationdefault value is now""(empty string), previously"document". - Breaking
req.redirectdefault value is now""follow", previously"manual". - Breaking
The library no longer exports the
parseIsomorphicRequest()function (#1316). Please useMockedRequestclass instead. - Deprecated
req.bodyis deprecated. Please use explicit request body reading methods:req.text(),req.json(),req.arrayBuffer()(other methods, likereq.formData()are currently not supported).
Release note
Breaking changes
- Breaking
req.destinationdefault value is now""(empty string), previously"document". - Breaking
req.redirectdefault value is now""follow", previously"manual". - Breaking
The library no longer exports the
parseIsomorphicRequest()function (#1316). Please useMockedRequestclass instead.
Features
Adhere to Fetch API "Request" in response resolver (#1316, @95th) (fc7f00c). This means the addition of a few properties on the
reqinstance:req.priority, indicates a priority of request relatively to other requests (default"auto");req.text(), reads the request body as plain text;req.json(), reads the request body as JSON;req.arrayBuffer(), reads the request body asArrayBuffer;req.clone(), clones a request instance (i.e. so its body could be read multiple times).
Remove unnecessary stringification of worker-client messages
Deprecations
- Deprecated
req.bodyis deprecated. Please use explicit request body reading methods:req.text(),req.json(),req.arrayBuffer()(other methods, likereq.formData()are currently not supported).
rest.post('/user', async (req, res, ctx) => {
const newUser = await req.json()
})
req.bodyis still present for compatibility reasons but will be removed in the next releases.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.