nock 14.0.15 → 14.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/intercept.js +7 -0
  2. package/package.json +1 -1
package/lib/intercept.js CHANGED
@@ -398,6 +398,13 @@ function activate() {
398
398
  globalEmitter.emit('no match', nockRequest)
399
399
  } else {
400
400
  nockRequest.on('response', nockResponse => {
401
+ // Guard against the case where the AbortSignal fired before nock
402
+ // finished building the response. In that scenario the interceptor
403
+ // has already transitioned the request to an error state and calling
404
+ // controller.respondWith() would throw an InterceptorError.
405
+ if (mswRequest.signal.aborted) {
406
+ return
407
+ }
401
408
  const response = createResponse(nockResponse, mswRequest.signal)
402
409
  controller.respondWith(response)
403
410
  })
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "testing",
8
8
  "isolation"
9
9
  ],
10
- "version": "14.0.15",
10
+ "version": "14.0.16",
11
11
  "author": "Pedro Teixeira <pedro.teixeira@gmail.com>",
12
12
  "repository": {
13
13
  "type": "git",