mswjs / interceptors

Low-level network interception library.
https://npm.im/@mswjs/interceptors
MIT License
523 stars 118 forks source link

fix: support throwing `Response.error()` #563

Closed kettanaito closed 2 months ago

kettanaito commented 2 months ago

Previously, throwing a Response.erorr() will fall through the instanceof Response check and be used as a mocked response. That would actually thrown an error.

Now, we have an extra check for thrown responses, if they are a Response.error(), it will result in the network error (i.e. request error) just as it does if you do request.respondWith(Response.error()).

kettanaito commented 2 months ago

This is a bug fix so I will merge this straight away.

kettanaito commented 2 months ago

Released: v0.28.4 🎉

This has been released in v0.28.4!

Make sure to always update to the latest version (npm i @mswjs/interceptors@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.