Seamless REST/GraphQL API mocking library for browser and Node.js.
MIT License
Bot releases are hidden (Show)
Published by kettanaito 11 months ago
Published by kettanaito 11 months ago
Published by kettanaito 11 months ago
Published by kettanaito 11 months ago
Published by kettanaito 11 months ago
Published by kettanaito 12 months ago
Published by kettanaito 12 months ago
Published by kettanaito 12 months ago
body
type for HttpResponse.json()
to be serializable json (#1838) (2af274c154d2e0b696188c10ba1f0271e900c40a) @kettanaitoPublished by kettanaito 12 months ago
Published by kettanaito 12 months ago
Published by kettanaito 12 months ago
Published by kettanaito almost 1 year ago
[!IMPORTANT]
This release is a BREAKING CHANGE. Please follow the Migration guidelines to upgrade. This release took a lot of effort to make, and I expect a bit of that effort on your part while upgrading. Most of the changes are mechanical, and a simple Find/Replace All will get you a long way. For the rest of it, you will learn how to handle requests and responses using the standard JavaScript API. Thank you!
< 4.7
.setupWorker
, SetupWorkerApi
, etc., must be imported from msw/browser
now.rest
object to http
(rest.get
-> http.get
).(req, res, ctx) => res()
but instead ({ request }) => new Response()
.response
context
and related exports (defaultContext
, restContext
, graphqlContext
).compose
and createResponseComposition
res.once()
is removed in favor of the { once: boolean }
option on the request handler..printHandlers()
method with .listHandlers()
.NetworkError
class in favor of the standard Response.error()
.crypto.randomUUID()
instead of Math.random()
in the worker.Request
and Response
instances respectively.ReadableStream
as a mocked response body.FormData
.FormData
as a mocked response body.File
polyfill in Node.js.{ once: true }
request handler option.RequestHandler
API public.FormData
.FormData
response body.URLSearchParams
as the request body couldn’t be read.referrerPolicy
was reset to a different value than the original.XMLHttpRequest
events and readyState
changes.responseType
equal to "arraybuffer"
as an incorrect buffer (previously, always assumed to be a string).XMLHttpRequest
events when the request fails.status
equal to 0 until the request actually resolves.onload
event callback was called twice for XMLHttpRequest
.@dbritto-dev @ddolcimascolo @markwhitfeld @christoph-fricke @thepassle @piotr-cz @mattcosta7 @koddsson @dkobierski @ricardocosta @dxlbnl @zkochan @felipefreitag @weyert @95th @committomaster @Xayer @Kosai106 @colinsullivan @xmlking @thw0rted @lee-reinhardt @wKovacs64 @TeChn4K @cmolina @nickrttn @thomasbertet @mscottnelson @jonnedeprez @negabaro @the-ult @WesleyYue @cwagner22 @skvale @alawiii521 @csantos1113 @elliotgonzalez123 @committomaster @tsteckenborn @xxleyi @jonnedeprez @danny-does-stuff @lemcii @mattrodak @luisr-carrillo @lee-reinhardt @ealejandrootalvaro @tomdglenn91
Published by kettanaito about 1 year ago
Published by kettanaito about 1 year ago
Published by kettanaito about 1 year ago
Published by kettanaito about 1 year ago
Published by kettanaito about 1 year ago
Published by kettanaito over 1 year ago
Published by kettanaito over 1 year ago
ReadableStream
responses as text/json (#1622) (4c7e952e69f1a82115fafa695ae39b3169486570) @esquevin @kettanaitoPublished by kettanaito over 1 year ago