diff --git a/lib/_http_server.js b/lib/_http_server.js index 84f2696b307165..9afdaad72bd187 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -703,7 +703,7 @@ function resOnFinish(req, res, socket, state, server) { // If the user never called req.read(), and didn't pipe() or // .resume() or .on('data'), then we call req._dump() so that the // bytes will be pulled off the wire. - if (!req._consuming && !req._readableState.resumeScheduled) + if (!req._consuming && req.paused) req._dump(); res.detachSocket(socket); diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 18af26d1e9f719..6482bfe328dd35 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -1215,6 +1215,22 @@ ObjectDefineProperties(Readable.prototype, { } }, + pipesCount: { + enumerable: false, + get() { + return this._readableState ? this._readableState.pipesCount : 0; + } + }, + + paused: { + enumerable: false, + get() { + return this._readableState ? this._readableState.paused : false; + } + } +}); + +ObjectDefineProperties(ReadableState.prototype, { // Legacy getter for `pipesCount` pipesCount: { get() {