msw

Seamless REST/GraphQL API mocking library for browser and Node.js.

MIT License

Downloads
15.7M
Stars
14.9K
Committers
153

Bot releases are hidden (Show)

msw - v0.45.0

Published by kettanaito about 2 years ago

v0.45.0 (2022-08-22)

Features

  • make GraphQL a peer dependency, support GraphQL v15.0 (#1356) (ca0e2e074d8156a6cbd212501e28130b9118f824)
msw - v0.44.2

Published by kettanaito over 2 years ago

v0.44.2 (2022-07-19)

Bug Fixes

  • transfer mocked response as ArrayBuffer to the worker (#1337) (95be5f8ac1c0f02b2d4b5e6e0dd02d2cf7342008)
msw - v0.44.1

Published by kettanaito over 2 years ago

v0.44.1 (2022-07-14)

Bug Fixes

  • super call stack overflow (#1328) (6a3f442bdea1d4ba615020ccece22a9e091e5f3c)
msw - v0.44.0

Published by kettanaito over 2 years ago

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 use MockedRequest class instead.

Features

  • adhere to Fetch API "Request" in response resolver (#1316, @95th) (fc7f00c96e79ad0be83cbaf7c82ceff23f0c4355). 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 as ArrayBuffer;
    • req.clone(), clones a request instance (i.e. so its body could be read multiple times).
  • remove unnecessary stringification of worker-client messages (#1320) (6990c3a57a1f515fe977c2eaa7741005b885b8af)

Deprecations

  • req.body is deprecated. Please use explicit request body reading methods: req.text(), req.json(), req.arrayBuffer() (other methods, like req.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.

msw - v0.43.1

Published by kettanaito over 2 years ago

v0.43.1 (2022-07-07)

Bug Fixes

  • support multiple response cookies using "ctx.cookie()" (#1311) (66c3ad888058f92db7dc94ad9d1c408a4ea9e14f)
msw - v0.43.0

Published by kettanaito over 2 years ago

v0.43.0 (2022-07-04)

Features

  • send mocked response body as ReadableStream to the worker (#1288) (78c7d7eee84b961eb29b2591bd78f81e0c48deef)
msw - v0.42.3

Published by kettanaito over 2 years ago

v0.42.3 (2022-06-22)

Bug Fixes

  • apply response delay conditionally (#1300) (496154da7e76007977d0c5e937a79e0fc55ae34b)
msw - v0.42.2

Published by kettanaito over 2 years ago

v0.42.2 (2022-06-22)

Bug Fixes

  • setupServer: reference interceptors to support fast refresh (#1299) (72f0b2516bc2fd0372cd62fc54fcf1f4e0b46b7f)
msw - v0.42.1

Published by kettanaito over 2 years ago

v0.42.1 (2022-06-07)

Bug Fixes

  • add "ctx.field()" for GraphQL responses (#1257) (442f48dd606fca8fa9156785fc0e85e9e9d48793)
msw - v0.42.0

Published by kettanaito over 2 years ago

v0.42.0 (2022-05-30)

Features

  • upgrade to @mswjs/interceptors 0.16 (#1262) (2176577bebda3b6e3a3f6027f4f0ebe2974af86a)

Bug Fixes

  • remove "esm" build target (#1263) (61a755a4b2672187847bfaf95f99b5f984c64854)
msw - v0.41.1

Published by kettanaito over 2 years ago

v0.41.1 (2022-05-27)

Bug Fixes

  • support typescript 4.7 (#1256) (b02027005969c70fd414df1d45def9ebed1a88c3)
msw - v0.41.0

Published by kettanaito over 2 years ago

v0.41.0 (2022-05-22)

Features

  • improve module formats (cjs, esm, iife) (#1247) (00e9c58c242d77fc5ce7966ce6e289b0a7e2cf0e)
msw - v0.40.2

Published by kettanaito over 2 years ago

v0.40.2 (2022-05-20)

Bug Fixes

  • support typescript 4.4.x, 4.5.x, 4.6.x (#1245) (5378416792be4f0d573149290f920e10ffdd2c61)
msw - v0.40.1

Published by kettanaito over 2 years ago

v0.40.1 (2022-05-19)

Bug Fixes

  • support typescript 4.3.x (#1244) (3bca5be178cf719b7776654b6875baba664af5af)
msw - v0.40.0

Published by kettanaito over 2 years ago

v0.40.0 (2022-05-17)

Breaking changes

  • Returning undefined, or early returns, from response resolvers, now does not perform request as-is, and is instead treated as a handler that didn't do anything. Please return req.passthrough() if you wish to bypass a request.
rest.get('/resource', (req, res, ctx) => {
// I want to perform this intercepted request as-is.
-  return
+  return req.passthrough()
})

Features

  • add "unhandledException" life-cycle event (#1199) (5c9079904202bf968c0f7c3c8da0fa68173ce7b4)
  • improve PathParams type to support interface (#1219) (b70266f4da5baa94e746fa56d9cd02594304799d)
  • rename "DefaultRequestBody" to "DefaultBodyType" (53aa3a1c755685a56ae240ebc0f1fe2d3468527a)
  • add "req.passthrough" (#1204) (4e1b1ad87a87240d7ff6ff9f07fee3521e23435d)
  • add service worker scope and worker script URL to "Mocking enabled" message (#1172) (ab3d3996728985bc4d1c8c820eb91e9e5a3d9378)
  • set "typescript" optional peer dependency to 4.2.x (#985) (b1004a6d89bd737cb8784c937298120d95ce364e)

Bug Fixes

  • setupWorker: warn on multiple "worker.start" and "worker.stop" calls (#1238) (cfe07099587827b8e482015e47ba2d1a49119cd2)
  • remove console.log from "setRequestCookies" (6f7ed98cfcbfc20c614c6f1e5b1fe0da9010ed62)
  • set "credentials" to "same-origin" for "ClientRequest" (#1159) (c3cd80a724eacae897a2d06fbec0eb9107be525c)
msw - v0.39.2

Published by kettanaito over 2 years ago

0.39.2 (2022-03-15)

Bug Fixes

  • parseIsomorphicRequest: bypassing cookies properly (#1155) (755bc9d)
  • set "credentials" to "same-origin" for "ClientRequest" (#1159) (c3cd80a)
  • set minimal supported Node.js version to 14 (#1160) (d7ab139)
msw -

Published by kettanaito almost 3 years ago

Bug fixes

  • Fixes an issue that resulted in port numbers being treated as path parameters (#1036, #1028).
msw -

Published by kettanaito almost 3 years ago

Bug fixes

  • Fixes an issue that resulted in the CORS policy violation due to the library appending the x-msw-request-id request header (#713, #1022, #1024).

Internal

  • No longer sets the x-msw-request-id header on the request (#1024). Relies on the request.id set by the interceptors (Node.js) or the requestId generated by the worker (browser).
msw -

Published by kettanaito almost 3 years ago

Bug fixes

  • Fixes an issue that resulted in the "TypeError: expected.toLowerCase() is not a function" exception when using the rest.all() request handler (#1020, #1021).
msw -

Published by kettanaito almost 3 years ago

Bug fixes

  • Fixes an issue that resulted in the "SyntaxError: Invalid group specified name" exception in Safari (#1018, #1019 ).