Closed kettanaito closed 1 month ago
This has been released in v0.36.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.
The following error is thrown when reusing the same function as an event listener for WebSocket:
It is thrown because the
kBoundListener
symbol is trying to be redefined for another listener being attached:https://github.com/mswjs/interceptors/blob/4fab617266b94e1c84235e355bad1e86687c1850/src/interceptors/WebSocket/WebSocketClientConnection.ts#L91-L96
Instead, we should check if
kBoundListener
is defined, and if it is, ignore that definition. That means you are reusing the same listener.