Closed kettanaito closed 11 months ago
This has been released in v0.25.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.
Changes
This change drops the internal implementation of
AsyncEventEmitter
used to await allrequest
listeners from being done. Instead, it introduces aRequestConrtoller
that just holds a response Promise to whichever surface calling.respondWith()
.The request listener await logic is achieved by:
once
request listener that always responds to the intercepted request with `undefined. using the request controller. This leverages the native listeners execution order to provide a fall-safe listener in case the consumer hasn't handled the request in any way.emitAsync
utility to account for async request listeners.emitAsync
executes all the listeners for the given events awaiting them (i.e. in order).