nock 14.0.0-beta.1 → 14.0.0-beta.2
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.
- package/lib/intercept.js +6 -1
- package/package.json +1 -1
package/lib/intercept.js
CHANGED
|
@@ -238,6 +238,8 @@ function removeInterceptor(options) {
|
|
|
238
238
|
// Variable where we keep the ClientRequest we have overridden
|
|
239
239
|
// (which might or might not be node's original http.ClientRequest)
|
|
240
240
|
let originalClientRequest
|
|
241
|
+
// Variable where we keep the fetch we have overridden
|
|
242
|
+
let originalFetch
|
|
241
243
|
|
|
242
244
|
function ErroringClientRequest(error) {
|
|
243
245
|
http.OutgoingMessage.call(this)
|
|
@@ -339,6 +341,9 @@ function restoreOverriddenClientRequest() {
|
|
|
339
341
|
http.ClientRequest = originalClientRequest
|
|
340
342
|
originalClientRequest = undefined
|
|
341
343
|
|
|
344
|
+
global.fetch = originalFetch
|
|
345
|
+
originalFetch = undefined
|
|
346
|
+
|
|
342
347
|
debug('- ClientRequest restored')
|
|
343
348
|
}
|
|
344
349
|
}
|
|
@@ -437,7 +442,7 @@ function activate() {
|
|
|
437
442
|
}
|
|
438
443
|
})
|
|
439
444
|
|
|
440
|
-
|
|
445
|
+
originalFetch = global.fetch
|
|
441
446
|
global.fetch = async (input, init = undefined) => {
|
|
442
447
|
const request = new Request(input, init)
|
|
443
448
|
const options = common.convertFetchRequestToClientRequest(request)
|