Releases: mswjs/msw
Releases · mswjs/msw
v0.45.0
v0.44.2
v0.44.1
v0.44.0
v0.44.0 (2022-07-13)
Breaking changes
req.destination
default value is now""
(empty string), previously"document"
.req.redirect
default value is now""follow"
, previously"manual"
.- The library no longer exports the
parseIsomorphicRequest()
function (#1316). Please useMockedRequest
class instead.
Features
- adhere to Fetch API "Request" in response resolver (#1316, @95th) (fc7f00c). This means the addition of a few properties on the
req
instance: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 (#1320) (6990c3a)
Deprecations
req.body
is 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.body
is still present for compatibility reasons but will be removed in the next releases.