mswjs / interceptors

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

fix: treat thrown responses as mocked responses #553

Closed kettanaito closed 5 months ago

kettanaito commented 5 months ago

Throwing a Response instance in a request listener is now equivalent to calling request.respondWith(thrownResponse).

interceptor.on('request', () => {
  throw new Response('hello world')
})
kettanaito commented 5 months ago

Released: v0.28.2 🎉

This has been released in v0.28.2!

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.