Repository navigation
Tags: nock/nock
Tags
Merge remote-tracking branch 'origin/main' into beta
fix: remove interceptor from scope.interceptors on nock.removeInterce… …ptor (#2997) When calling nock.removeInterceptor(interceptor) with an Interceptor instance, it removed the interceptor from the global interceptors list and from keyedInterceptors, but not from scope.interceptors. This meant scope.interceptors.length stayed the same after removal. Add a splice to also remove the interceptor from scope.interceptors.
fix: guard against AbortSignal-aborted requests in response handler (#… …2977) When a request's AbortSignal fires, @mswjs/interceptors immediately transitions the request to an error state. If nock's response callback runs after that transition (e.g. because a reply delay was configured), calling controller.respondWith() throws an InterceptorError ("the request has already been handled"). Add a signal.aborted check before respondWith() so that a late-firing response callback exits early rather than throwing. Fixes #2949
PreviousNext