Comparing version 12.0.2 to 12.0.3
@@ -145,2 +145,3 @@ 'use strict' | ||
// handle the different overloaded param signatures | ||
if (typeof chunk === 'function') { | ||
@@ -154,11 +155,9 @@ callback = chunk | ||
if (typeof callback === 'function') { | ||
req.once('finish', callback) | ||
} | ||
if (!req.aborted && !this.playbackStarted) { | ||
req.write(chunk, encoding, () => { | ||
if (typeof callback === 'function') { | ||
callback() | ||
} | ||
this.startPlayback() | ||
req.emit('finish') | ||
req.emit('end') | ||
}) | ||
req.write(chunk, encoding) | ||
this.startPlayback() | ||
} | ||
@@ -168,2 +167,4 @@ if (req.aborted) { | ||
} | ||
return req | ||
} | ||
@@ -277,2 +278,7 @@ | ||
// wait to emit the finish event until we know for sure an Interceptor is going to playback. | ||
// otherwise an unmocked request might emit finish twice. | ||
req.finished = true | ||
req.emit('finish') | ||
playbackInterceptor({ | ||
@@ -279,0 +285,0 @@ req, |
@@ -75,3 +75,3 @@ 'use strict' | ||
/** | ||
* Play back an intercepto using the given request and mock response. | ||
* Play back an interceptor using the given request and mock response. | ||
*/ | ||
@@ -78,0 +78,0 @@ function playbackInterceptor({ |
@@ -16,2 +16,3 @@ 'use strict' | ||
this.bufferSize = 0 | ||
this.writableLength = 0 | ||
this.writable = true | ||
@@ -18,0 +19,0 @@ this.readable = true |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "12.0.2", | ||
"version": "12.0.3", | ||
"author": "Pedro Teixeira <pedro.teixeira@gmail.com>", | ||
@@ -13,0 +13,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
170196
3397